From 30eaa02822b5710bd1b71d234d05275cce9ab527 Mon Sep 17 00:00:00 2001 From: Amit Upadhye Date: Tue, 25 Jun 2019 15:46:50 +0530 Subject: [PATCH] Fixes #27122 - Sat 6.6.z scenario --- .../scenarios/upgrade_to_satellite_6_6_z.rb | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 definitions/scenarios/upgrade_to_satellite_6_6_z.rb diff --git a/definitions/scenarios/upgrade_to_satellite_6_6_z.rb b/definitions/scenarios/upgrade_to_satellite_6_6_z.rb new file mode 100644 index 000000000..96ea504f3 --- /dev/null +++ b/definitions/scenarios/upgrade_to_satellite_6_6_z.rb @@ -0,0 +1,80 @@ +module Scenarios::Satellite_6_6_z + class Abstract < ForemanMaintain::Scenario + def self.upgrade_metadata(&block) + metadata do + tags :upgrade_to_satellite_6_6_z + confine do + feature(:downstream) && feature(:downstream).current_minor_version == '6.6' + end + instance_eval(&block) + end + end + end + + class PreUpgradeCheck < Abstract + upgrade_metadata do + description 'Checks before upgrading to Satellite 6.6.z' + tags :pre_upgrade_checks + run_strategy :fail_slow + end + + def compose + add_steps(find_checks(:default)) + add_steps(find_checks(:pre_upgrade)) + add_step(Checks::Repositories::Validate.new(:version => '6.6')) + end + end + + class PreMigrations < Abstract + upgrade_metadata do + description 'Procedures before migrating to Satellite 6.6.z' + tags :pre_migrations + end + + def compose + add_steps(find_procedures(:pre_migrations)) + add_step(Procedures::Service::Stop.new) + end + end + + class Migrations < Abstract + upgrade_metadata do + description 'Migration scripts to Satellite 6.6.z' + tags :migrations + end + + def compose + add_step(Procedures::Repositories::Setup.new(:version => '6.6')) + add_step(Procedures::Packages::UnlockVersions.new) + add_step(Procedures::Packages::Update.new(:assumeyes => true)) + add_step(Procedures::Installer::Upgrade.new) + end + end + + class PostMigrations < Abstract + upgrade_metadata do + description 'Procedures after migrating to Satellite 6.6.z' + tags :post_migrations + end + + def compose + add_step(Procedures::Service::Start.new) + add_steps(find_procedures(:post_migrations)) + end + end + + class PostUpgradeChecks < Abstract + upgrade_metadata do + description 'Checks after upgrading to Satellite 6.6.z' + tags :post_upgrade_checks + run_strategy :fail_slow + end + + def compose + add_steps(find_checks(:default)) + add_steps(find_checks(:post_upgrade)) + end + end +end + +ForemanMaintain::UpgradeRunner.register_version('6.6.z', :upgrade_to_satellite_6_6_z)