diff options
author | Adam Jacob <adam@hjksolutions.com> | 2008-09-08 16:55:47 -0700 |
---|---|---|
committer | Adam Jacob <adam@hjksolutions.com> | 2008-09-08 16:55:47 -0700 |
commit | 5c850d49d0b0f1928fad1cecfe9de1585ffa9fe6 (patch) | |
tree | 4ea773e4a918bf23b6d8109d6b987e34ea19000f | |
parent | 4e900251deaafa619e725ec350253a0bcb98ad68 (diff) | |
download | chef-5c850d49d0b0f1928fad1cecfe9de1585ffa9fe6.tar.gz |
Lets throw some more reasonable errors
-rw-r--r-- | lib/chef/runner.rb | 39 |
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 |