summaryrefslogtreecommitdiff
path: root/lib/chef/provider/route.rb
diff options
context:
space:
mode:
authorXabier de Zuazo <xabier@zuazo.org>2012-11-29 02:05:43 +0100
committerBryan McLellan <btm@opscode.com>2013-05-24 11:27:59 -0700
commit0311b2ea85d619a7a31d5ab39ac282ae5988753e (patch)
treea8af5fb379d92b56982a938b90c85266c9980010 /lib/chef/provider/route.rb
parent621af1b5a6571b19df1624133536fc345062658f (diff)
downloadchef-0311b2ea85d619a7a31d5ab39ac282ae5988753e.tar.gz
[CHEF-3332] Fixed: The route resource provider will always delete config file even for :add action
Diffstat (limited to 'lib/chef/provider/route.rb')
-rw-r--r--lib/chef/provider/route.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/chef/provider/route.rb b/lib/chef/provider/route.rb
index 5aedcb99ec..a4968d6a69 100644
--- a/lib/chef/provider/route.rb
+++ b/lib/chef/provider/route.rb
@@ -152,6 +152,9 @@ class Chef::Provider::Route < Chef::Provider
else
Chef::Log.debug("#{@new_resource} route does not exist - nothing to do")
end
+
+ #for now we always write the file (ugly but its what it is)
+ generate_config
end
def generate_config
@@ -169,9 +172,10 @@ class Chef::Provider::Route < Chef::Provider
end
conf[dev] = String.new if conf[dev].nil?
- if resource.action == :add
+ case resource.action.last
+ when :add
conf[dev] << config_file_contents(:add, :target => resource.target, :netmask => resource.netmask, :gateway => resource.gateway)
- else
+ when :delete
# need to do this for the case when the last route on an int
# is removed
conf[dev] << config_file_contents(:delete)