summaryrefslogtreecommitdiff
path: root/lib/chef/provider
diff options
context:
space:
mode:
authorScott Hain <shain@chef.io>2017-11-16 12:38:24 -0800
committerScott Hain <shain@chef.io>2017-11-16 14:17:22 -0800
commitef54ad304c62e4e456a412f95c5acf55ffed2874 (patch)
treef21f984e3cdb3145fb04a1a9d183bbb19f1f1fc6 /lib/chef/provider
parent4ea68802a17735e8938339fd03f7fe41b1fa1ca2 (diff)
downloadchef-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.rb11
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*):?\ .+$/