diff options
author | Thom May <thom@chef.io> | 2018-04-23 13:45:01 +0100 |
---|---|---|
committer | Thom May <thom@chef.io> | 2018-05-17 12:28:39 +0100 |
commit | 25c68f4a08b08a12c658c99d296b57f3d70b5ec3 (patch) | |
tree | 773893bd8ea7129dc122166a9cc12730e4a80ae8 | |
parent | f4f40ec1e2161228300e61f3fe34d47ad38fbd45 (diff) | |
download | chef-tm/12_1804.tar.gz |
begin fix up of ifconfig provider on 1804tm/12_1804
Signed-off-by: Thom May <thom@chef.io>
-rw-r--r-- | lib/chef/provider/ifconfig/debian.rb | 2 | ||||
-rw-r--r-- | spec/functional/resource/ifconfig_spec.rb | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/chef/provider/ifconfig/debian.rb b/lib/chef/provider/ifconfig/debian.rb index 369c222b7a..4560c0c477 100644 --- a/lib/chef/provider/ifconfig/debian.rb +++ b/lib/chef/provider/ifconfig/debian.rb @@ -62,6 +62,8 @@ iface <%= new_resource.device %> inet static protected def enforce_interfaces_dot_d_sanity + # on ubuntu 18.04 there's no interfaces file and it uses interfaces.d by default + return if ::File.directory?(INTERFACES_DOT_D_DIR) && !::File.exist?(INTERFACES_FILE) # create /etc/network/interfaces.d via dir resource (to get reporting, etc) dir = Chef::Resource::Directory.new(INTERFACES_DOT_D_DIR, run_context) dir.run_action(:create) diff --git a/spec/functional/resource/ifconfig_spec.rb b/spec/functional/resource/ifconfig_spec.rb index fbb8995d52..f32ed069b5 100644 --- a/spec/functional/resource/ifconfig_spec.rb +++ b/spec/functional/resource/ifconfig_spec.rb @@ -16,6 +16,7 @@ # limitations under the License. # +require "spec_helper" require "functional/resource/base" require "chef/mixin/shell_out" @@ -52,7 +53,7 @@ describe Chef::Resource::Ifconfig, :requires_root, :skip_travis, :external => in end def fetch_first_interface_name - shell_out("ifconfig | grep Ethernet | head -1 | cut -d' ' -f1").stdout.strip + shell_out("ip link list |grep UP|grep -vi loop|head -1|cut -d':' -f 2").stdout.strip end # **Caution: any updates to core interfaces can be risky. |