Skip to content

Commit

Permalink
Fixes #37285 - Properly process data we get from checking on proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
adamruzicka committed Mar 21, 2024
1 parent 9cf91af commit 4029b47
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def process_task_results(tasks, results)
notify ::Actions::ProxyAction::ProxyActionMissing.new, missing if missing.any?

stopped = present.select { |task| %w[stopped paused].include? results.dig(task.remote_task_id, 'state') }
notify ::Actions::ProxyAction::ProxyActionStopped.new, stopped if stopped.any?
notify ::Actions::ProxyAction::ProxyActionStoppedEvent[nil], stopped if stopped.any?
end

def notify(event, tasks)
Expand Down
11 changes: 2 additions & 9 deletions app/lib/actions/proxy_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,8 @@ def proxy_input(task_id = task.id)

def check_task_status
response = proxy.status_of_task(proxy_task_id)
if %w[stopped paused].include? response['state']
if response['result'] == 'error'
raise ::Foreman::Exception, _('The smart proxy task %s failed.') % proxy_task_id
else
on_data(get_proxy_data(response))
end
else
suspend
end
on_data(get_proxy_data(response))
suspend unless %w[stopped paused].include? response['state']
rescue RestClient::NotFound
on_proxy_action_missing
end
Expand Down

0 comments on commit 4029b47

Please sign in to comment.