-
Notifications
You must be signed in to change notification settings - Fork 72
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 #36877 - Add a pre-upgrade check for katello-agent #782
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
require 'yaml' | ||
|
||
class Checks::CheckKatelloAgentEnabled < ForemanMaintain::Check | ||
metadata do | ||
label :check_katello_agent_enabled | ||
description 'Check whether the katello-agent feature is enabled before upgrading' | ||
tags :pre_upgrade | ||
|
||
confine do | ||
!feature(:capsule) | ||
end | ||
end | ||
|
||
def run | ||
instance_name = feature(:instance).downstream ? "Satellite" : "Katello" | ||
instance_version = feature(:instance).downstream ? "6.15" : "4.10" | ||
installer_command = feature(:instance).downstream ? "satellite-installer" : "foreman-installer" | ||
maintain_command = feature(:instance).downstream ? "satellite-maintain" : "foreman-maintain" | ||
|
||
assert( | ||
!katello_agent_enabled?, | ||
"The katello-agent feature is enabled on this system. As of #{instance_name}"\ | ||
" #{instance_version}, katello-agent is removed and will no longer function."\ | ||
" Before proceeding with the upgrade, you should ensure that you have deployed"\ | ||
" and configured an alternative tool for remote package management and patching"\ | ||
" for content hosts, such as Remote Execution (REX) with pull-based transport."\ | ||
" See the Managing Hosts guide in the #{instance_name} documentation for more info."\ | ||
" Disable katello-agent with the command"\ | ||
" `#{installer_command} --foreman-proxy-content-enable-katello-agent false`"\ | ||
" before proceeding with the upgrade. Alternatively, you may skip this check and proceed by"\ | ||
" running #{maintain_command} again with the `--whitelist` option, which will automatically"\ | ||
" uninstall katello-agent." | ||
) | ||
end | ||
|
||
private | ||
|
||
def katello_agent_enabled? | ||
feature(:installer).answers['foreman_proxy_content']['enable_katello_agent'] | ||
end | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
As someone new to foreman-maintain, I'm still not sure what command it's telling me to run here. I assume it's not just
foreman-maintain --whitelist
? Can it give me the exact command I would run?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 need to figure out how the name to pass to
--whitelist
is constructed from the label:check_katello_agent_enabled
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.
OK, so it would be
--whitelist="check-katello-agent-enabled"
but it turns out the exact language shouldn't be necessary here.The reason why is that if ANY checks fail, there is general language explaining how to whitelist the failed step.