-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a pre-upgrade check for katello-agent
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
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,38 @@ | ||
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 | ||
end | ||
|
||
confine do | ||
feature(:instance).downstream | ||
end | ||
|
||
INSTALLER_ANSWERS_FILE = '/etc/foreman-installer/scenarios.d/satellite-answers.yaml'.freeze | ||
|
||
def run | ||
assert( | ||
!katello_agent_enabled?, | ||
"The katello-agent feature is enabled on this system. As of Satellite 6.15.0, 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 the Remote Execution (REX) Pull Provider. See the"\ | ||
" Managing Hosts guide in the Satellite documentation. Disable katello-agent with the command"\ | ||
" `satellite-installer --foreman-proxy-content-enable-katello-agent false`"\ | ||
" before proceeding with the upgrade." | ||
) | ||
end | ||
|
||
private | ||
|
||
def katello_agent_enabled? | ||
return false unless File.exist?(INSTALLER_ANSWERS_FILE) | ||
|
||
answers = YAML.load_file(INSTALLER_ANSWERS_FILE) | ||
|
||
answers['foreman_proxy_content']['enable_katello_agent'] == true | ||
end | ||
end |