summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsakazuki <sakazuki@gmail.com>2014-01-08 09:48:36 +0900
committerLamont Granquist <lamont@scriptkiddie.org>2014-09-10 14:49:29 -0700
commit8cec934b19fe0eb1d6943064eee22e18ac22e7c3 (patch)
tree89a8094b07e81f21a89f56fc0003365fd26a2c3a
parent7d944c37a04172daa9b9702d4822870cc439f96a (diff)
downloadchef-8cec934b19fe0eb1d6943064eee22e18ac22e7c3.tar.gz
fix CHEF-4933
-rw-r--r--lib/chef/provider/ifconfig.rb15
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/chef/provider/ifconfig.rb b/lib/chef/provider/ifconfig.rb
index 31f88e5406..3dc092942e 100644
--- a/lib/chef/provider/ifconfig.rb
+++ b/lib/chef/provider/ifconfig.rb
@@ -172,23 +172,16 @@ class Chef
return unless can_generate_config?
b = binding
template = ::ERB.new(@config_template)
- converge_by ("generate configuration file : #{@config_path}") do
- network_file = ::File.new(@config_path, "w")
- network_file.puts(template.result(b))
- network_file.close
+ file @config_path do
+ content template.result(b)
end
- Chef::Log.info("#{@new_resource} created configuration file")
end
def delete_config
return unless can_generate_config?
- require 'fileutils'
- if ::File.exist?(@config_path)
- converge_by ("delete the #{@config_path}") do
- FileUtils.rm_f(@config_path, :verbose => false)
- end
+ file @config_path do
+ action :delete
end
- Chef::Log.info("#{@new_resource} deleted configuration file")
end
private