Commit bbc1ddc2 authored by Adam Edwards's avatar Adam Edwards
Browse files

Remove customizable exception handling, unused source line parameter

parent 8fef6af5
......@@ -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]
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment