Skip to content

Commit

Permalink
Fixes #37158: Explicitly define upgrade steps in upgrade scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
ehelms committed Jun 24, 2024
1 parent 8477f49 commit 421c348
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 21 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,6 @@ Style/StderrPuts:

Metrics/ParameterLists:
Max: 6

Style/TrailingCommaInArguments:
Enabled: false
94 changes: 73 additions & 21 deletions definitions/scenarios/satellite_upgrade.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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

Expand All @@ -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

0 comments on commit 421c348

Please sign in to comment.