diff options
-rw-r--r-- | lib/chef/resource.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/conditional/guard_interpreter.rb | 8 |
2 files changed, 4 insertions, 6 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index 4a182c28ab..e4fe404fdb 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -836,7 +836,7 @@ F guard_resource = guard_interpreter guard_resource = nil if guard_interpreter == :default if guard_resource && command && ! block_given? - evaluator = Conditional::GuardInterpreter.new(guard_resource, self, [Mixlib::ShellOut::ShellCommandFailed]) + evaluator = Conditional::GuardInterpreter.new(guard_resource, self) block_attributes = opts.merge({:code => command}) translated_block = evaluator.to_block(block_attributes) [nil, translated_block] diff --git a/lib/chef/resource/conditional/guard_interpreter.rb b/lib/chef/resource/conditional/guard_interpreter.rb index 0165b51aae..f50fcf3f75 100644 --- a/lib/chef/resource/conditional/guard_interpreter.rb +++ b/lib/chef/resource/conditional/guard_interpreter.rb @@ -22,10 +22,10 @@ class Chef class Resource::Conditional class GuardInterpreter - def initialize(resource_symbol, parent_resource, handled_exceptions, source_line=nil) + def initialize(resource_symbol, parent_resource) resource_class = get_resource_class(parent_resource, resource_symbol) - raise ArgumentError, "Specified resource #{resource_symbol.to_s} unknown for this platform" if resource_class.nil? + raise ArgumentError, "Specified guard_interpreter resource #{resource_symbol.to_s} unknown for this platform" if resource_class.nil? empty_events = Chef::EventDispatch::Dispatcher.new anonymous_run_context = Chef::RunContext.new(parent_resource.node, {}, empty_events) @@ -36,9 +36,7 @@ class Chef raise ArgumentError, "Specified guard interpreter class #{resource_class} must be a kind of Chef::Resource::Script resource" end - @handled_exceptions = handled_exceptions ? handled_exceptions : [] merge_inherited_attributes(parent_resource) - @source_line = source_line if source_line end def evaluate_action(action=nil, &block) @@ -49,7 +47,7 @@ class Chef begin @resource.run_action(run_action) resource_updated = @resource.updated - rescue *@handled_exceptions + rescue Mixlib::ShellOut::ShellCommandFailed resource_updated = nil end |