Skip to content
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

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

adamruzicka
Copy link
Contributor

No description provided.

@adamruzicka adamruzicka marked this pull request as ready for review March 21, 2024 09:25
@adamruzicka adamruzicka changed the title Fixes #TBFL - Fix proxy task gone missing, vol. 2 Fixes #37285 - Properly process data we get from checking on proxy Mar 21, 2024
@@ -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?
Copy link
Member

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

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
?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly

Comment on lines 97 to 98
if response['result'] == 'error'
raise ::Foreman::Exception, _('The smart proxy task %s failed.') % proxy_task_id
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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

@adamruzicka
Copy link
Contributor Author

@ofedoren anything else to do here?

Copy link
Member

@ofedoren ofedoren left a 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.

@ofedoren ofedoren merged commit 7715212 into theforeman:master Jul 17, 2024
23 checks passed
@adamruzicka adamruzicka deleted the missing-vol2 branch July 17, 2024 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants