diff --git a/definitions/checks/katello_agent.rb b/definitions/checks/katello_agent.rb new file mode 100644 index 000000000..8099a2240 --- /dev/null +++ b/definitions/checks/katello_agent.rb @@ -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