summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2018-04-23 13:45:01 +0100
committerThom May <thom@chef.io>2018-05-17 12:29:39 +0100
commitbdbac2219d5165e14823612b6006378b06b75cab (patch)
tree3cbab3ebc48e302091a61eb644c968f091f4e48a
parent8324aa0445ac228ba227fbf4cebdeb878f6dc8a0 (diff)
downloadchef-bdbac2219d5165e14823612b6006378b06b75cab.tar.gz
begin fix up of ifconfig provider on 1804
Signed-off-by: Thom May <thom@chef.io>
-rw-r--r--lib/chef/provider/ifconfig/debian.rb2
-rw-r--r--spec/functional/resource/ifconfig_spec.rb3
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.