summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-10-19 16:01:28 -0700
committerTim Smith <tsmith84@gmail.com>2020-10-19 16:01:28 -0700
commitbdf5a3c5cc2bf32285fd9981816d25823cfec728 (patch)
tree08852704a0dad01218ad000b3c434e8393da50d3
parent1ae5a2b77a0e090e06b20a1fa952b17dc719e0da (diff)
downloadchef-bdf5a3c5cc2bf32285fd9981816d25823cfec728.tar.gz
Use a native resource in the ifconfig debian provider
We're in unified mode. There's no need to work with classes when we can just use the DSL here. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/provider/ifconfig/debian.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/chef/provider/ifconfig/debian.rb b/lib/chef/provider/ifconfig/debian.rb
index baab06128b..9b359d7c54 100644
--- a/lib/chef/provider/ifconfig/debian.rb
+++ b/lib/chef/provider/ifconfig/debian.rb
@@ -83,10 +83,9 @@ iface <%= new_resource.device %> <%= new_resource.family %> static
# 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)
- new_resource.updated_by_last_action(true) if dir.updated_by_last_action?
+ # create /etc/network/interfaces.d via dir if it's missing
+ directory INTERFACES_DOT_D_DIR
+
# roll our own file_edit resource, this will not get reported until we have a file_edit resource
interfaces_dot_d_for_regexp = INTERFACES_DOT_D_DIR.gsub(/\./, '\.') # escape dots for the regexp
regexp = %r{^\s*source\s+#{interfaces_dot_d_for_regexp}/\*\s*$}