From 421c34859d1f34f6c4010c29fbd6b8039fcd9ea2 Mon Sep 17 00:00:00 2001 From: "Eric D. Helms" Date: Sat, 10 Feb 2024 13:44:06 +0000 Subject: [PATCH] Fixes #37158: Explicitly define upgrade steps in upgrade scenario --- .rubocop.yml | 3 + definitions/scenarios/satellite_upgrade.rb | 94 +++++++++++++++++----- 2 files changed, 76 insertions(+), 21 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index e3761e41a..a7617fec0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -125,3 +125,6 @@ Style/StderrPuts: Metrics/ParameterLists: Max: 6 + +Style/TrailingCommaInArguments: + Enabled: false diff --git a/definitions/scenarios/satellite_upgrade.rb b/definitions/scenarios/satellite_upgrade.rb index 3bf91f353..5f2cd0292 100644 --- a/definitions/scenarios/satellite_upgrade.rb +++ b/definitions/scenarios/satellite_upgrade.rb @@ -23,14 +23,41 @@ class PreUpgradeCheck < Abstract run_strategy :fail_slow end + # rubocop:disable Metrics/MethodLength def compose - add_steps(find_checks(:default)) - add_steps(find_checks(:pre_upgrade)) - add_step(Checks::CheckIpv6Disable) - add_step(Checks::Disk::AvailableSpacePostgresql13) - add_step(Checks::Repositories::Validate.new(:version => target_version)) - add_step(Checks::CheckOrganizationContentAccessMode) + add_steps( + Checks::Foreman::FactsNames, # if Foreman database present + Checks::ForemanProxy::CheckTftpStorage, # if Satellite with foreman-proxy+tftp + Checks::ForemanProxy::VerifyDhcpConfigSyntax, # if foreman-proxy+dhcp-isc + Checks::ForemanTasks::NotPaused, # if foreman-tasks present + Checks::Puppet::VerifyNoEmptyCacertRequests, # if puppetserver + Checks::ServerPing, + Checks::ServicesUp, + Checks::SystemRegistration, + Checks::CheckHotfixInstalled, + Checks::CheckTmout, + Checks::CheckUpstreamRepository, + Checks::Disk::AvailableSpace, + Checks::Disk::AvailableSpaceCandlepin, # if candlepin + Checks::Foreman::ValidateExternalDbVersion, # if external database + Checks::Foreman::CheckCorruptedRoles, + Checks::Foreman::CheckDuplicatePermissions, + Checks::Foreman::TuningRequirements, # if katello present + Checks::ForemanOpenscap::InvalidReportAssociations, # if foreman-openscap + Checks::ForemanTasks::Invalid::CheckOld, # if foreman-tasks + Checks::ForemanTasks::Invalid::CheckPendingState, # if foreman-tasks + Checks::ForemanTasks::Invalid::CheckPlanningState, # if foreman-tasks + Checks::ForemanTasks::NotRunning, # if foreman-tasks + Checks::NonRhPackages, + Checks::PackageManager::Dnf::ValidateDnfConfig, + Checks::Repositories::CheckNonRhRepository, + Checks::CheckIpv6Disable, + Checks::Disk::AvailableSpacePostgresql13, + Checks::CheckOrganizationContentAccessMode, + Checks::Repositories::Validate.new(:version => target_version), + ) end + # rubocop:enable Metrics/MethodLength end class PreMigrations < Abstract @@ -40,7 +67,18 @@ class PreMigrations < Abstract end def compose - add_steps(find_procedures(:pre_migrations)) + modules_to_enable = ["satellite:#{el_short_name}"] + add_steps( + Procedures::Repositories::Setup.new(:version => target_version), + Procedures::Packages::EnableModules.new(:module_names => modules_to_enable), + Procedures::Packages::Update.new( + :assumeyes => true, + :dnf_options => ['--downloadonly'] + ), + Procedures::MaintenanceMode::EnableMaintenanceMode, + Procedures::Crond::Stop, + Procedures::SyncPlans::Disable, + ) end end @@ -63,12 +101,14 @@ def compose modules_to_enable = ["satellite:#{el_short_name}"] add_step(Procedures::Packages::EnableModules.new(:module_names => modules_to_enable)) end - add_step(Procedures::Packages::Update.new( - :assumeyes => true, - :download_only => true - )) - add_step(Procedures::Service::Stop.new) - add_step(Procedures::Packages::Update.new(:assumeyes => true, :clean_cache => false)) + add_steps( + Procedures::Packages::Update.new( + :assumeyes => true, + :download_only => true + ), + Procedures::Service::Stop, + Procedures::Packages::Update.new(:assumeyes => true, :clean_cache => false), + ) add_step_with_context(Procedures::Installer::Run) add_step(Procedures::Installer::UpgradeRakeTask) end @@ -81,9 +121,13 @@ class PostMigrations < Abstract end def compose - add_step(Procedures::RefreshFeatures) - add_step(Procedures::Service::Start.new) - add_steps(find_procedures(:post_migrations)) + add_steps( + Procedures::RefreshFeatures, + Procedures::Service::Start, + Procedures::Crond::Start, + Procedures::SyncPlans::Enable, + Procedures::MaintenanceMode::DisableMaintenanceMode, + ) end end @@ -95,11 +139,19 @@ class PostUpgradeChecks < Abstract end def compose - add_steps(find_checks(:default)) - add_steps(find_checks(:post_upgrade)) - add_step(Procedures::Packages::CheckForReboot) - add_step(Procedures::Pulpcore::ContainerHandleImageMetadata) - add_step(Procedures::Repositories::IndexKatelloRepositoriesContainerMetatdata) + add_steps( + Checks::Foreman::FactsNames, # if Foreman database present + Checks::ForemanProxy::CheckTftpStorage, # if Satellite with foreman-proxy+tftp + Checks::ForemanProxy::VerifyDhcpConfigSyntax, # if foreman-proxy+dhcp-isc + Checks::ForemanTasks::NotPaused, # if foreman-tasks present + Checks::Puppet::VerifyNoEmptyCacertRequests, # if puppetserver + Checks::ServerPing, + Checks::ServicesUp, + Checks::SystemRegistration, + Procedures::Packages::CheckForReboot, + Procedures::Pulpcore::ContainerHandleImageMetadata, + Procedures::Repositories::IndexKatelloRepositoriesContainerMetatdata, + ) end end end