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 Feb 11, 2024
1 parent f6974d9 commit 453a03a
Show file tree
Hide file tree
Showing 10 changed files with 253 additions and 44 deletions.
36 changes: 28 additions & 8 deletions definitions/scenarios/upgrade_to_capsule_6_16.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,22 @@ class PreUpgradeCheck < Abstract
end

def compose
add_steps(find_checks(:default))
add_steps(find_checks(:pre_upgrade))
add_steps(
Checks::ForemanProxy::VerifyDhcpConfigSyntax.new, # if foreman-proxy+dhcp-isc
Checks::Puppet::VerifyNoEmptyCacertRequests.new, # if puppetserver
Checks::ServerPing.new,
Checks::ServicesUp.new,
Checks::SystemRegistration.new
)
add_steps(
Checks::CheckHotfixInstalled.new,
Checks::CheckTmout.new,
Checks::CheckUpstreamRepository.new,
Checks::Disk::AvailableSpace.new,
Checks::NonRhPackages.new,
Checks::PackageManager::Dnf::ValidateDnfConfig.new,
Checks::Repositories::CheckNonRhRepository.new
)
add_step(Checks::Repositories::Validate.new(:version => '6.16'))
end
end
Expand All @@ -45,8 +59,8 @@ def compose
:assumeyes => true,
:dnf_options => ['--downloadonly']
))

add_steps(find_procedures(:pre_migrations))
add_step(Procedures::MaintenanceMode::EnableMaintenanceMode.new)
add_step(Procedures::Crond::Stop.new)
end
end

Expand Down Expand Up @@ -74,9 +88,10 @@ class PostMigrations < Abstract
end

def compose
add_step(Procedures::RefreshFeatures)
add_step(Procedures::RefreshFeatures.new)
add_step(Procedures::Service::Start.new)
add_steps(find_procedures(:post_migrations))
add_step(Procedures::Crond::Start.new)
add_step(Procedures::MaintenanceMode::DisableMaintenanceMode.new)
end
end

Expand All @@ -88,8 +103,13 @@ class PostUpgradeChecks < Abstract
end

def compose
add_steps(find_checks(:default))
add_steps(find_checks(:post_upgrade))
add_steps(
Checks::ForemanProxy::VerifyDhcpConfigSyntax.new, # if foreman-proxy+dhcp-isc
Checks::Puppet::VerifyNoEmptyCacertRequests.new, # if puppetserver
Checks::ServerPing.new,
Checks::ServicesUp.new,
Checks::SystemRegistration.new
)
add_step(Procedures::Packages::CheckForReboot)
end
end
Expand Down
35 changes: 28 additions & 7 deletions definitions/scenarios/upgrade_to_capsule_6_16_z.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,22 @@ class PreUpgradeCheck < Abstract
end

def compose
add_steps(find_checks(:default))
add_steps(find_checks(:pre_upgrade))
add_steps(
Checks::ForemanProxy::VerifyDhcpConfigSyntax.new, # if foreman-proxy+dhcp-isc
Checks::Puppet::VerifyNoEmptyCacertRequests.new, # if puppetserver
Checks::ServerPing.new,
Checks::ServicesUp.new,
Checks::SystemRegistration.new
)
add_steps(
Checks::CheckHotfixInstalled.new,
Checks::CheckTmout.new,
Checks::CheckUpstreamRepository.new,
Checks::Disk::AvailableSpace.new,
Checks::NonRhPackages.new,
Checks::PackageManager::Dnf::ValidateDnfConfig.new,
Checks::Repositories::CheckNonRhRepository.new
)
add_step(Checks::Repositories::Validate.new(:version => '6.16'))
end
end
Expand All @@ -45,7 +59,8 @@ def compose
:assumeyes => true,
:dnf_options => ['--downloadonly']
))
add_steps(find_procedures(:pre_migrations))
add_step(Procedures::MaintenanceMode::EnableMaintenanceMode.new)
add_step(Procedures::Crond::Stop.new)
end
end

Expand Down Expand Up @@ -73,9 +88,10 @@ class PostMigrations < Abstract
end

def compose
add_step(Procedures::RefreshFeatures)
add_step(Procedures::RefreshFeatures.new)
add_step(Procedures::Service::Start.new)
add_steps(find_procedures(:post_migrations))
add_step(Procedures::Crond::Start.new)
add_step(Procedures::MaintenanceMode::DisableMaintenanceMode.new)
end
end

Expand All @@ -87,8 +103,13 @@ class PostUpgradeChecks < Abstract
end

def compose
add_steps(find_checks(:default))
add_steps(find_checks(:post_upgrade))
add_steps(
Checks::ForemanProxy::VerifyDhcpConfigSyntax.new, # if foreman-proxy+dhcp-isc
Checks::Puppet::VerifyNoEmptyCacertRequests.new, # if puppetserver
Checks::ServerPing.new,
Checks::ServicesUp.new,
Checks::SystemRegistration.new
)
add_step(Procedures::Packages::CheckForReboot)
end
end
Expand Down
46 changes: 39 additions & 7 deletions definitions/scenarios/upgrade_to_foreman_nightly.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,32 @@ 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_steps(
Checks::Foreman::FactsNames.new, # if Foreman database present
Checks::ForemanProxy::CheckTftpStorage.new, # if Satellite with foreman-proxy+tftp
Checks::ForemanProxy::VerifyDhcpConfigSyntax.new, # if foreman-proxy+dhcp-isc
Checks::ForemanTasks::NotPaused.new, # if foreman-tasks present
Checks::Puppet::VerifyNoEmptyCacertRequests.new, # if puppetserver
Checks::ServerPing.new,
Checks::ServicesUp.new
)
add_steps(
Checks::CheckTmout.new,
Checks::Disk::AvailableSpace.new,
Checks::Foreman::ValidateExternalDbVersion.new, # if external database
Checks::Foreman::CheckCorruptedRoles.new,
Checks::Foreman::CheckDuplicatePermissions.new,
Checks::ForemanOpenscap::InvalidReportAssociations.new, # if foreman-openscap
Checks::ForemanTasks::Invalid::CheckOld.new, # if foreman-tasks
Checks::ForemanTasks::Invalid::CheckPendingState.new, # if foreman-tasks
Checks::ForemanTasks::Invalid::CheckPlanningState.new, # if foreman-tasks
Checks::ForemanTasks::NotRunning.new, # if foreman-tasks
Checks::PackageManager::Dnf::ValidateDnfConfig.new
)
end
# rubocop:enable Metrics/MethodLength
end

class PreMigrations < Abstract
Expand All @@ -35,7 +57,8 @@ class PreMigrations < Abstract
end

def compose
add_steps(find_procedures(:pre_migrations))
add_step(Procedures::MaintenanceMode::EnableMaintenanceMode.new)
add_step(Procedures::Crond::Stop.new)
end
end

Expand Down Expand Up @@ -68,9 +91,10 @@ class PostMigrations < Abstract
end

def compose
add_step(Procedures::RefreshFeatures)
add_step(Procedures::RefreshFeatures.new)
add_step(Procedures::Service::Start.new)
add_steps(find_procedures(:post_migrations))
add_step(Procedures::Crond::Start.new)
add_step(Procedures::MaintenanceMode::DisableMaintenanceMode.new)
end
end

Expand All @@ -82,8 +106,16 @@ class PostUpgradeChecks < Abstract
end

def compose
add_steps(find_checks(:default))
add_steps(find_checks(:post_upgrade))
add_steps(
Checks::Foreman::FactsNames.new, # if Foreman database present
Checks::ForemanProxy::CheckTftpStorage.new, # if Satellite with foreman-proxy+tftp
Checks::ForemanProxy::VerifyDhcpConfigSyntax.new, # if foreman-proxy+dhcp-isc
Checks::ForemanTasks::NotPaused.new, # if foreman-tasks present
Checks::Puppet::VerifyNoEmptyCacertRequests.new, # if puppetserver
Checks::ServerPing.new,
Checks::ServicesUp.new
)
add_step(Procedures::Packages::CheckForReboot)
end
end
end
53 changes: 47 additions & 6 deletions definitions/scenarios/upgrade_to_katello_nightly.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,37 @@ class PreUpgradeCheck < Abstract
run_strategy :fail_slow
end

# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
def compose
add_steps(find_checks(:default))
add_steps(find_checks(:pre_upgrade))
add_steps(
Checks::Foreman::FactsNames.new, # if Foreman database present
Checks::ForemanProxy::CheckTftpStorage.new, # if Satellite with foreman-proxy+tftp
Checks::ForemanProxy::VerifyDhcpConfigSyntax.new, # if foreman-proxy+dhcp-isc
Checks::ForemanTasks::NotPaused.new, # if foreman-tasks present
Checks::Puppet::VerifyNoEmptyCacertRequests.new, # if puppetserver
Checks::ServerPing.new,
Checks::ServicesUp.new,
Checks::SystemRegistration.new
)
add_steps(
Checks::CheckHotfixInstalled.new,
Checks::CheckTmout.new,
Checks::CheckUpstreamRepository.new,
Checks::Disk::AvailableSpace.new,
Checks::Disk::AvailableSpaceCandlepin.new, # if candlepin
Checks::Foreman::ValidateExternalDbVersion.new, # if external database
Checks::Foreman::CheckCorruptedRoles.new,
Checks::Foreman::CheckDuplicatePermissions.new,
Checks::Foreman::TuningRequirements.new, # if katello present
Checks::ForemanOpenscap::InvalidReportAssociations.new, # if foreman-openscap
Checks::ForemanTasks::Invalid::CheckOld.new, # if foreman-tasks
Checks::ForemanTasks::Invalid::CheckPendingState.new, # if foreman-tasks
Checks::ForemanTasks::Invalid::CheckPlanningState.new, # if foreman-tasks
Checks::ForemanTasks::NotRunning.new, # if foreman-tasks
Checks::PackageManager::Dnf::ValidateDnfConfig.new
)
end
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize
end

class PreMigrations < Abstract
Expand All @@ -35,7 +62,9 @@ class PreMigrations < Abstract
end

def compose
add_steps(find_procedures(:pre_migrations))
add_step(Procedures::MaintenanceMode::EnableMaintenanceMode.new)
add_step(Procedures::Crond::Stop.new)
add_step(Procedures::SyncPlans::Disable.new)
end
end

Expand All @@ -61,6 +90,7 @@ def compose
add_step(Procedures::Service::Stop.new)
add_step(Procedures::Packages::Update.new(:assumeyes => true, :clean_cache => false))
add_step_with_context(Procedures::Installer::Upgrade)
add_step(Procedures::Installer::UpgradeRakeTask)
end
end

Expand All @@ -73,7 +103,9 @@ class PostMigrations < Abstract
def compose
add_step(Procedures::RefreshFeatures)
add_step(Procedures::Service::Start.new)
add_steps(find_procedures(:post_migrations))
add_step(Procedures::Crond::Start.new)
add_step(Procedures::SyncPlans::Enable.new)
add_step(Procedures::MaintenanceMode::DisableMaintenanceMode.new)
end
end

Expand All @@ -85,8 +117,17 @@ class PostUpgradeChecks < Abstract
end

def compose
add_steps(find_checks(:default))
add_steps(find_checks(:post_upgrade))
add_steps(
Checks::Foreman::FactsNames.new, # if Foreman database present
Checks::ForemanProxy::CheckTftpStorage.new, # if Satellite with foreman-proxy+tftp
Checks::ForemanProxy::VerifyDhcpConfigSyntax.new, # if foreman-proxy+dhcp-isc
Checks::ForemanTasks::NotPaused.new, # if foreman-tasks present
Checks::Puppet::VerifyNoEmptyCacertRequests.new, # if puppetserver
Checks::ServerPing.new,
Checks::ServicesUp.new,
Checks::SystemRegistration.new
)
add_step(Procedures::Packages::CheckForReboot)
end
end
end
55 changes: 48 additions & 7 deletions definitions/scenarios/upgrade_to_satellite_6_16.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,40 @@ class PreUpgradeCheck < Abstract
run_strategy :fail_slow
end

# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
def compose
add_steps(find_checks(:default))
add_steps(find_checks(:pre_upgrade))
add_steps(
Checks::Foreman::FactsNames.new, # if Foreman database present
Checks::ForemanProxy::CheckTftpStorage.new, # if Satellite with foreman-proxy+tftp
Checks::ForemanProxy::VerifyDhcpConfigSyntax.new, # if foreman-proxy+dhcp-isc
Checks::ForemanTasks::NotPaused.new, # if foreman-tasks present
Checks::Puppet::VerifyNoEmptyCacertRequests.new, # if puppetserver
Checks::ServerPing.new,
Checks::ServicesUp.new,
Checks::SystemRegistration.new
)
add_steps(
Checks::CheckHotfixInstalled.new,
Checks::CheckTmout.new,
Checks::CheckUpstreamRepository.new,
Checks::Disk::AvailableSpace.new,
Checks::Disk::AvailableSpaceCandlepin.new, # if candlepin
Checks::Foreman::ValidateExternalDbVersion.new, # if external database
Checks::Foreman::CheckCorruptedRoles.new,
Checks::Foreman::CheckDuplicatePermissions.new,
Checks::Foreman::TuningRequirements.new, # if katello present
Checks::ForemanOpenscap::InvalidReportAssociations.new, # if foreman-openscap
Checks::ForemanTasks::Invalid::CheckOld.new, # if foreman-tasks
Checks::ForemanTasks::Invalid::CheckPendingState.new, # if foreman-tasks
Checks::ForemanTasks::Invalid::CheckPlanningState.new, # if foreman-tasks
Checks::ForemanTasks::NotRunning.new, # if foreman-tasks
Checks::NonRhPackages.new,
Checks::PackageManager::Dnf::ValidateDnfConfig.new,
Checks::Repositories::CheckNonRhRepository.new
)
add_step(Checks::Repositories::Validate.new(:version => '6.16'))
end
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize
end

class PreMigrations < Abstract
Expand All @@ -45,7 +74,9 @@ def compose
:assumeyes => true,
:dnf_options => ['--downloadonly']
))
add_steps(find_procedures(:pre_migrations))
add_step(Procedures::MaintenanceMode::EnableMaintenanceMode.new)
add_step(Procedures::Crond::Stop.new)
add_step(Procedures::SyncPlans::Disable.new)
end
end

Expand Down Expand Up @@ -75,9 +106,11 @@ class PostMigrations < Abstract
end

def compose
add_step(Procedures::RefreshFeatures)
add_step(Procedures::RefreshFeatures.new)
add_step(Procedures::Service::Start.new)
add_steps(find_procedures(:post_migrations))
add_step(Procedures::Crond::Start.new)
add_step(Procedures::SyncPlans::Enable.new)
add_step(Procedures::MaintenanceMode::DisableMaintenanceMode.new)
end
end

Expand All @@ -89,8 +122,16 @@ class PostUpgradeChecks < Abstract
end

def compose
add_steps(find_checks(:default))
add_steps(find_checks(:post_upgrade))
add_steps(
Checks::Foreman::FactsNames.new, # if Foreman database present
Checks::ForemanProxy::CheckTftpStorage.new, # if Satellite with foreman-proxy+tftp
Checks::ForemanProxy::VerifyDhcpConfigSyntax.new, # if foreman-proxy+dhcp-isc
Checks::ForemanTasks::NotPaused.new, # if foreman-tasks present
Checks::Puppet::VerifyNoEmptyCacertRequests.new, # if puppetserver
Checks::ServerPing.new,
Checks::ServicesUp.new,
Checks::SystemRegistration.new
)
add_step(Procedures::Packages::CheckForReboot)
end
end
Expand Down
Loading

0 comments on commit 453a03a

Please sign in to comment.