-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #37285 - Properly process data we get from checking on proxy #749
Conversation
9fce321
to
4029b47
Compare
@@ -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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I understand right, that this should correspond with
foreman-tasks/app/lib/actions/proxy_action.rb
Lines 48 to 69 in 124e9c6
def run(event = nil) | |
with_connection_error_handling(event) do |event| | |
case event | |
when nil | |
start_or_resume | |
when ::Dynflow::Action::Skip | |
# do nothing | |
when ::Dynflow::Action::Cancellable::Cancel | |
cancel_proxy_task | |
when ::Dynflow::Action::Cancellable::Abort | |
abort_proxy_task | |
when CallbackData | |
on_data(event.data, event.meta) | |
when ProxyActionMissing | |
on_proxy_action_missing | |
when ProxyActionStoppedEvent | |
on_proxy_action_stopped(event) | |
else | |
raise "Unexpected event #{event.inspect}" | |
end | |
end | |
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, exactly
app/lib/actions/proxy_action.rb
Outdated
if response['result'] == 'error' | ||
raise ::Foreman::Exception, _('The smart proxy task %s failed.') % proxy_task_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where this will be checked instead? Or we don't need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might have taken a shortcut here that I can't really take.
There's the ::Actions::ProxyAction in here, which (as far as I know) is only used in remote execution. Remote execution has a subclass which inherits from ::Actions::ProxyAction and adds a bunch of extensions. The changes here rely on those extensions. Thank you for pointing this out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept it mostly intact here and extracted the rex specific parts to theforeman/foreman_remote_execution#900
@ofedoren anything else to do here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, @adamruzicka, let's get it.
No description provided.