Skip to content

Commit

Permalink
Add a pre-upgrade check for katello-agent
Browse files Browse the repository at this point in the history
  • Loading branch information
wbclark committed Oct 23, 2023
1 parent ad8d414 commit c7bfa99
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions definitions/checks/katello_agent.rb
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

0 comments on commit c7bfa99

Please sign in to comment.