summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2018-04-23 13:45:01 +0100
committerThom May <thom@chef.io>2018-04-23 13:45:01 +0100
commit708e8e084bd715e2dd6e25f0157a5e081691fa55 (patch)
treea1a149a58ff52abca452369f0990ae18a208bf74
parentf3698119a48d4706bccd4767f3c50f0820f9ae5c (diff)
downloadchef-708e8e084bd715e2dd6e25f0157a5e081691fa55.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 e1e978fdde..aee3ca02dc 100644
--- a/lib/chef/provider/ifconfig/debian.rb
+++ b/lib/chef/provider/ifconfig/debian.rb
@@ -62,6 +62,8 @@ iface <%= new_resource.device %> <%= new_resource.family %> 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.