lib/bolt/result.rb in bolt-1.33.0 vs lib/bolt/result.rb in bolt-1.34.0

- old
+ new

@@ -90,16 +90,19 @@ @value['_output'] end def status_hash # DEPRECATION: node in status hashes is deprecated and should be removed in 2.0 - { node: @target.name, + base = { target: @target.name, action: action, object: object, - status: ok? ? 'success' : 'failure', - result: @value } + status: status + } + # rubocop:disable Style/GlobalVars + $future ? base.merge(value: @value) : base.merge(result: @value, node: @target.name) + # rubocop:enable Style/GlobalVars end def generic_value if @value_set value.reject { |k, _| %w[_error _output].include? k } @@ -128,9 +131,13 @@ to_json end def to_data Bolt::Util.walk_keys(status_hash, &:to_s) + end + + def status + ok? ? 'success' : 'failure' end def ok? error_hash.nil? end