Skip to content

Commit

Permalink
Fixes #37284 - Do not overwrite results
Browse files Browse the repository at this point in the history
  • Loading branch information
adamruzicka authored and ofedoren committed Jul 25, 2024
1 parent c2964a6 commit cba48c4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
12 changes: 12 additions & 0 deletions lib/smart_proxy_dynflow/action/middleware/assemble_results.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

module Proxy::Dynflow::Action::Middleware
class AssembleResults < ::Dynflow::Middleware
def present
unless %i[error success skipped].include?(action.run_step&.state)
action.output[:result] = action.output_result
end
pass
end
end
end
4 changes: 4 additions & 0 deletions lib/smart_proxy_dynflow/action/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

require 'smart_proxy_dynflow/action/shareable'
require 'smart_proxy_dynflow/action/external_polling'
require 'smart_proxy_dynflow/action/middleware/assemble_results'

module Proxy::Dynflow
module Action
class Runner < Shareable
include ::Dynflow::Action::Cancellable
include ::Proxy::Dynflow::Action::WithExternalPolling

middleware.use ::Proxy::Dynflow::Action::Middleware::AssembleResults

def run(event = nil)
case event
when nil
Expand Down
8 changes: 1 addition & 7 deletions lib/smart_proxy_dynflow/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,10 @@ def refresh_output(execution_plan, action)
end
end

def expand_output(action)
hash = action.to_hash
hash[:output][:result] = action.output_result if action.is_a?(Proxy::Dynflow::Action::Runner)
hash
end

def execution_plan_status(plan)
actions = plan.actions.map do |action|
refresh_output(plan, action)
expand_output(action)
action.to_hash
end
plan.to_hash.merge(:actions => actions)
end
Expand Down

0 comments on commit cba48c4

Please sign in to comment.