-
Notifications
You must be signed in to change notification settings - Fork 293
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 #36665 - Remove katello-agent API endpoints and rabl nodes #10690
Fixes #36665 - Remove katello-agent API endpoints and rabl nodes #10690
Conversation
Issues: #36665 |
@host.content_facet.expects(:cves_changed?).returns(false) | ||
::Katello::Resources::Candlepin::Consumer.expects(:destroy) | ||
::Katello::EventQueue.expects(:push_event).never | ||
::Katello::RegistrationManager.unregister_host(@host, :unregistering => true) | ||
end | ||
|
||
def test_unregister_host_with_katello_agent |
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 was admiring your work when it occurred to me that there's always a small chance that after all this cleanup is done, there may be "delete host agent queue" events in the db which will break the event queue when they get processed because their handler class will be removed. You'll need an upgrade rake task to delete those from the events table. Obviously, on the PR when you remove that stuff
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.
Yeah, I was just thinking about delete_host_agent_queue and how to handle that.. 😢
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 we need that? Isn't the queue emptied when upgrading any way?
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.
The queue isn't explicitly emptied on upgrade and there could be events on it especially for this specific case because it's scheduled to run ten minutes in the future. Any hosts unregistered ~10 minutes before shutdown will put the events on queue and if Katello is upgraded with that event removed it'll raise an error around an unsupported event. There could also be events stuck on the queue due to this bug: #10692
Looking at the code:
katello/app/services/katello/event_queue.rb
Lines 73 to 75 in c9fe25d
def self.event_class(event_type) | |
fail _("Invalid event_type %s") % event_type if @event_types[event_type].nil? | |
@event_types[event_type].constantize |
An error gets raised if an unsupported event is found on queue which is what will happen when the event's class is removed from the app. However, that error may be rescued, logged, and the event removed:
katello/app/services/katello/event_monitor/poller_thread.rb
Lines 61 to 70 in c9fe25d
begin | |
::User.as_anonymous_admin do | |
event_instance = ::Katello::EventQueue.create_instance(event) | |
event_instance.run | |
end | |
rescue => e | |
@failed_count += 1 | |
@logger.error("event_queue_error: type=#{event.event_type}, object_id=#{event.object_id}") | |
@logger.error(e.message) | |
@logger.error(e.backtrace.join("\n")) |
Definitely test that to make sure it doesn't break the queue though.
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.
So, do you think I should add to the rescue here instead of the upgrade rake task?
Either way, can this be addressed in a followup issue?
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 think the rescue & ensure that are there will handle the situation already - but that needs a confirmation - definitely outside of the scope here!
a656b3e
to
6eb2a30
Compare
@parthaa Updated route overrides 👍 |
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.
LGTM ;)
e748a28
to
e9a2f16
Compare
Waiting until theforeman/forklift#1695 is merged. |
e9a2f16
to
8ba3396
Compare
8ba3396
to
9aba33a
Compare
[test katello] |
) (cherry picked from commit bb738c6)
) (cherry picked from commit bb738c6)
What are the changes introduced in this pull request?
Remove Katello API endpoints that use katello-agent:
/hosts/:host_id/errata/apply
/hosts/:host_id/packages/install
/hosts/:host_id/packages/upgrade
/hosts/:host_id/packages/upgrade_all
/hosts/:host_id/packages/remove
/hosts/bulk/install_content
/hosts/bulk/update_content
/hosts/bulk/remove_content
Also remove katello-agent from
api/ping
.Considerations taken when implementing this change?
This will break all related Hammer commands, so we should probably wait and merge the hammer-cli-katello PR at the same time as this one
What are the testing steps for this pull request?
Try existing hammer commands and confirm they're broken, I guess