Skip to content

Commit

Permalink
Fixes #35029 - Require Candlepin CA cert prior running installer
Browse files Browse the repository at this point in the history
(cherry picked from commit d709642)
  • Loading branch information
upadhyeammit committed Jun 8, 2022
1 parent 5195c15 commit 638ed5a
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
52 changes: 52 additions & 0 deletions definitions/procedures/installer/run_for_6_11.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
module Procedures::Installer
class RunFor6_11 < ForemanMaintain::Procedure
metadata do
description 'Run installer with Candlepin SSL CA'\
' when using external database with SSL'
param :assumeyes, 'Do not ask for confirmation'
manual_detection
end

def run
if extdb_and_ssl?
run_installer_with_extra_option
else
run_installer
end
end

def ext_db?
!feature(:foreman_database).local?
end

def installer_answers
@installer_answers ||= feature(:installer).answers
end

def server_db_with_ssl?
installer_answers.fetch('katello')['candlepin_db_ssl']
end

def extdb_and_ssl?
ext_db? && server_db_with_ssl?
end

def run_installer_with_extra_option
ssl_ca_path = installer_answers.fetch('foreman')['db_root_cert']
spinner_msg = "Running installer with --katello-candlepin-db-ssl-ca #{ssl_ca_path} argument!"
with_spinner(spinner_msg) do
installer_args = feature(:installer).installer_arguments
new_ssl_arg = " --katello-candlepin-db-ssl-ca #{ssl_ca_path}"
installer_args << new_ssl_arg
feature(:installer).run(installer_args)
end
end

def run_installer
with_spinner('Executing installer') do
assumeyes_val = @assumeyes.nil? ? assumeyes? : @assumeyes
feature(:installer).upgrade(:interactive => !assumeyes_val)
end
end
end
end
2 changes: 1 addition & 1 deletion definitions/scenarios/upgrade_to_satellite_6_11.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def compose
add_step(Procedures::Repositories::Setup.new(:version => '6.11'))
add_step(Procedures::Packages::UnlockVersions.new)
add_step(Procedures::Packages::Update.new(:assumeyes => true))
add_step_with_context(Procedures::Installer::Upgrade)
add_step_with_context(Procedures::Installer::RunFor6_11)
add_step(Procedures::Installer::UpgradeRakeTask)
end
end
Expand Down

0 comments on commit 638ed5a

Please sign in to comment.