summaryrefslogtreecommitdiff
path: root/lib/chef/runner.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/runner.rb')
-rw-r--r--lib/chef/runner.rb39
1 files changed, 22 insertions, 17 deletions
diff --git a/lib/chef/runner.rb b/lib/chef/runner.rb
index 0c5f91b796..cd2126494a 100644
--- a/lib/chef/runner.rb
+++ b/lib/chef/runner.rb
@@ -57,27 +57,32 @@ class Chef
delayed_actions = Array.new
@collection.each do |resource|
- 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}")
+ begin
+ 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}")
+ 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
+ rescue Exception => e
+ Chef::Log.error("#{resource} (#{resource.source_line} had an error:")
+ raise e
end
end