summaryrefslogtreecommitdiff
path: root/lib
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
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')
-rw-r--r--lib/chef/provider/route.rb8
-rw-r--r--lib/chef/resource/route.rb2
2 files changed, 7 insertions, 3 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)
diff --git a/lib/chef/resource/route.rb b/lib/chef/resource/route.rb
index cdd61f3a4b..c8680697af 100644
--- a/lib/chef/resource/route.rb
+++ b/lib/chef/resource/route.rb
@@ -31,7 +31,7 @@ class Chef
super
@resource_name = :route
@target = name
- @action = :add
+ @action = [:add]
@allowed_actions.push(:add, :delete)
@netmask = nil
@gateway = nil