diff options
author | Scott Hain <shain@chef.io> | 2017-11-16 12:38:24 -0800 |
---|---|---|
committer | Scott Hain <shain@chef.io> | 2017-11-16 14:17:22 -0800 |
commit | ef54ad304c62e4e456a412f95c5acf55ffed2874 (patch) | |
tree | f21f984e3cdb3145fb04a1a9d183bbb19f1f1fc6 /lib/chef/provider | |
parent | 4ea68802a17735e8938339fd03f7fe41b1fa1ca2 (diff) | |
download | chef-ef54ad304c62e4e456a412f95c5acf55ffed2874.tar.gz |
Don't run ifconfig tests on RHEL7, as it is not part of the base OS
Signed-off-by: Scott Hain <shain@chef.io>
Diffstat (limited to 'lib/chef/provider')
-rw-r--r-- | lib/chef/provider/ifconfig.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/chef/provider/ifconfig.rb b/lib/chef/provider/ifconfig.rb index 514049266f..65a65b276f 100644 --- a/lib/chef/provider/ifconfig.rb +++ b/lib/chef/provider/ifconfig.rb @@ -66,8 +66,9 @@ class Chef end end - case @ifconfig_version - when "1.60" + if @ifconfig_version.nil? + raise "net-tools not found - this is required for ifconfig" + elsif @ifconfig_version.to_f < 2.0 @status = shell_out("ifconfig") @status.stdout.each_line do |line| if !line[0..9].strip.empty? @@ -80,10 +81,10 @@ class Chef @interfaces[@int_name]["mtu"] = (line =~ /MTU:(\S+)/ ? Regexp.last_match(1) : "nil") if line =~ /MTU:/ @interfaces[@int_name]["metric"] = (line =~ /Metric:(\S+)/ ? Regexp.last_match(1) : "nil") if line =~ /Metric:/ end - + next unless @interfaces.key?(new_resource.device) @interface = @interfaces.fetch(new_resource.device) - + current_resource.target(new_resource.target) current_resource.device(new_resource.device) current_resource.inet_addr(@interface["inet_addr"]) @@ -93,7 +94,7 @@ class Chef current_resource.mtu(@interface["mtu"]) current_resource.metric(@interface["metric"]) end - when "2.10" + elsif @ifconfig_version.to_f >= 2.0 @status = shell_out("ifconfig") @status.stdout.each_line do |line| addr_regex = /^(\w+):?(\d*):?\ .+$/ |