summaryrefslogtreecommitdiff
path: root/spec/functional/resource/ifconfig_spec.rb
diff options
context:
space:
mode:
authorAliasgar16 <aliasgar.batterywala@msystechnologies.com>2016-09-23 06:29:26 +0530
committerMatt Wrock <matt@mattwrock.com>2016-09-22 17:59:26 -0700
commit49fd9e4b84912053b17b2c8ece1d7044bb7dbdc9 (patch)
tree720eda3d69c9e4b86c7ae2a8c6d56d86f81d8451 /spec/functional/resource/ifconfig_spec.rb
parent8e1312bbb5677c9fed1901f10053c8e85acb6d67 (diff)
downloadchef-49fd9e4b84912053b17b2c8ece1d7044bb7dbdc9.tar.gz
Fix for ifconfig resource's functional spec. (#5325)
* Modified ifconfig resource's functional spec to handle persistent stateless network interface names on Ubuntu platform. * Implemented the review comments.
Diffstat (limited to 'spec/functional/resource/ifconfig_spec.rb')
-rw-r--r--spec/functional/resource/ifconfig_spec.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/functional/resource/ifconfig_spec.rb b/spec/functional/resource/ifconfig_spec.rb
index a30dcff641..0298dbcf45 100644
--- a/spec/functional/resource/ifconfig_spec.rb
+++ b/spec/functional/resource/ifconfig_spec.rb
@@ -51,11 +51,17 @@ describe Chef::Resource::Ifconfig, :requires_root, :skip_travis, :external => in
end
end
+ def fetch_first_interface_name
+ shell_out("ifconfig | grep Ethernet | head -1 | cut -d' ' -f1").stdout.strip
+ end
+
# **Caution: any updates to core interfaces can be risky.
def en0_interface_for_test
case ohai[:platform]
when "aix"
"en0"
+ when "ubuntu"
+ fetch_first_interface_name
else
"eth0"
end