lib/bolt/result.rb in bolt-2.4.0 vs lib/bolt/result.rb in bolt-2.5.0
- old
+ new
@@ -5,11 +5,11 @@
module Bolt
class Result
attr_reader :target, :value, :action, :object
- def self.from_exception(target, exception)
+ def self.from_exception(target, exception, action: 'action')
if exception.is_a?(Bolt::Error)
error = exception.to_h
else
error = {
'kind' => 'puppetlabs.tasks/exception-error',
@@ -17,11 +17,11 @@
'msg' => exception.message,
'details' => { 'class' => exception.class.to_s }
}
error['details']['stack_trace'] = exception.backtrace.join('\n') if exception.backtrace
end
- Result.new(target, error: error)
+ Result.new(target, error: error, action: action)
end
def self.for_command(target, stdout, stderr, exit_code, action, command)
value = {
'stdout' => stdout,
@@ -88,10 +88,10 @@
'value' => @value,
'action' => @action,
'object' => @object }
end
- def initialize(target, error: nil, message: nil, value: nil, action: nil, object: nil)
+ def initialize(target, error: nil, message: nil, value: nil, action: 'action', object: nil)
@target = target
@value = value || {}
@action = action
@object = object
if error && !error.is_a?(Hash)