summaryrefslogtreecommitdiff
path: root/lib/chef/runner.rb
diff options
context:
space:
mode:
authorAdam Jacob <adam@hjksolutions.com>2008-09-08 16:55:47 -0700
committerAdam Jacob <adam@hjksolutions.com>2008-09-08 16:55:47 -0700
commit5c850d49d0b0f1928fad1cecfe9de1585ffa9fe6 (patch)
tree4ea773e4a918bf23b6d8109d6b987e34ea19000f /lib/chef/runner.rb
parent4e900251deaafa619e725ec350253a0bcb98ad68 (diff)
downloadchef-5c850d49d0b0f1928fad1cecfe9de1585ffa9fe6.tar.gz
Lets throw some more reasonable errors
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