From 889efcf600effbc51d6f4eb4d7672accd89a7139 Mon Sep 17 00:00:00 2001 From: William Bradford Clark Date: Mon, 23 Oct 2023 11:01:18 -0400 Subject: [PATCH] Add a pre-upgrade check for katello-agent --- definitions/checks/katello_agent.rb | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 definitions/checks/katello_agent.rb diff --git a/definitions/checks/katello_agent.rb b/definitions/checks/katello_agent.rb new file mode 100644 index 000000000..0ef1a1a0d --- /dev/null +++ b/definitions/checks/katello_agent.rb @@ -0,0 +1,39 @@ +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 Remote Execution (REX) with pull-based"\ + " transport. See the Managing Hosts guide in the Satellite documentation for more info."\ + " 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