summaryrefslogtreecommitdiff
path: root/lib/chef/runner.rb
diff options
context:
space:
mode:
authorAdam Jacob <adam@hjksolutions.com>2008-10-02 09:03:22 -0700
committerAdam Jacob <adam@hjksolutions.com>2008-10-02 09:03:22 -0700
commit5caef70b1307d7d099c2621dc9ff7a4c0b3268d6 (patch)
tree2a6ca8e9cf5be68798f00197870d10b132dcf34f /lib/chef/runner.rb
parent6257a566101870a5734edae03197c5b32b953773 (diff)
downloadchef-5caef70b1307d7d099c2621dc9ff7a4c0b3268d6.tar.gz
Supporting multiple actions
Diffstat (limited to 'lib/chef/runner.rb')
-rw-r--r--lib/chef/runner.rb31
1 files changed, 17 insertions, 14 deletions
diff --git a/lib/chef/runner.rb b/lib/chef/runner.rb
index 09a77556c1..15347fcfa1 100644
--- a/lib/chef/runner.rb
+++ b/lib/chef/runner.rb
@@ -61,21 +61,24 @@ class Chef
Chef::Log.debug("Processing #{resource}")
provider = build_provider(resource)
provider.load_current_resource
- provider.send("action_#{resource.action}")
- if resource.updated
- resource.actions.each_key do |action|
- if resource.actions[action].has_key?(:immediate)
- resource.actions[action][:immediate].each do |r|
- Chef::Log.info("#{resource} sending action #{action} to #{r} (immediate)")
- build_provider(r).send("action_#{action}")
+ action_list = resource.action.kind_of?(Array) ? resource.action : [ resource.action ]
+ action_list.each do |ra|
+ provider.send("action_#{ra}")
+ if resource.updated
+ resource.actions.each_key do |action|
+ if resource.actions[action].has_key?(:immediate)
+ resource.actions[action][:immediate].each do |r|
+ Chef::Log.info("#{resource} sending action #{action} to #{r} (immediate)")
+ build_provider(r).send("action_#{action}")
+ end
end
- end
- if resource.actions[action].has_key?(:delayed)
- resource.actions[action][:delayed].each do |r|
- delayed_actions << lambda {
- Chef::Log.info("#{resource} sending action #{action} to #{r} (delayed)")
- build_provider(r).send("action_#{action}")
- }
+ if resource.actions[action].has_key?(:delayed)
+ resource.actions[action][:delayed].each do |r|
+ delayed_actions << lambda {
+ Chef::Log.info("#{resource} sending action #{action} to #{r} (delayed)")
+ build_provider(r).send("action_#{action}")
+ }
+ end
end
end
end