From 1d1d5c2524103a6c73914375dd4d14e63b48d2b9 Mon Sep 17 00:00:00 2001 From: Samir Jha Date: Tue, 16 Apr 2024 20:10:07 +0000 Subject: [PATCH] Fixes #37357 - Add container migration to upgrade --- .../container_handle_image_metadata.rb | 23 +++++++++++++++++++ definitions/scenarios/foreman_upgrade.rb | 3 ++- .../scenarios/upgrade_to_capsule_6_16.rb | 1 + .../scenarios/upgrade_to_satellite_6_16.rb | 1 + 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 definitions/procedures/pulpcore/container_handle_image_metadata.rb diff --git a/definitions/procedures/pulpcore/container_handle_image_metadata.rb b/definitions/procedures/pulpcore/container_handle_image_metadata.rb new file mode 100644 index 000000000..108fcff93 --- /dev/null +++ b/definitions/procedures/pulpcore/container_handle_image_metadata.rb @@ -0,0 +1,23 @@ +module Procedures::Pulpcore + class ContainerHandleImageMetadata < ForemanMaintain::Procedure + include ForemanMaintain::Concerns::SystemService + include ForemanMaintain::Concerns::PulpCommon + + metadata do + description 'Initialize and expose container image metadata in the pulpcore db' + for_feature :pulpcore + end + + def run + with_spinner('Initialize and expose container image metadata in the pulpcore db') do |spinner| + necessary_services = feature(:pulpcore_database).services + + feature(:service).handle_services(spinner, 'start', :only => necessary_services) + + spinner.update('Adding image metadata to pulp. You can continue using the ' \ + 'system normally while the task runs in the background.') + execute!(pulpcore_manager('container-handle-image-data')) + end + end + end +end diff --git a/definitions/scenarios/foreman_upgrade.rb b/definitions/scenarios/foreman_upgrade.rb index 44d83c925..596902c6f 100644 --- a/definitions/scenarios/foreman_upgrade.rb +++ b/definitions/scenarios/foreman_upgrade.rb @@ -134,7 +134,8 @@ def compose Checks::ServerPing, Checks::ServicesUp, Checks::SystemRegistration, - Procedures::Packages::CheckForReboot + Procedures::Packages::CheckForReboot, + Procedures::Pulpcore::ContainerHandleImageMetadata ) end end diff --git a/definitions/scenarios/upgrade_to_capsule_6_16.rb b/definitions/scenarios/upgrade_to_capsule_6_16.rb index aa5db4cf6..2177d3c46 100644 --- a/definitions/scenarios/upgrade_to_capsule_6_16.rb +++ b/definitions/scenarios/upgrade_to_capsule_6_16.rb @@ -95,6 +95,7 @@ def compose add_steps(find_checks(:default)) add_steps(find_checks(:post_upgrade)) add_step(Procedures::Packages::CheckForReboot) + add_step(Procedures::Pulpcore::ContainerHandleImageMetadata) end end end diff --git a/definitions/scenarios/upgrade_to_satellite_6_16.rb b/definitions/scenarios/upgrade_to_satellite_6_16.rb index 8b1a85ce3..e2d31b2e3 100644 --- a/definitions/scenarios/upgrade_to_satellite_6_16.rb +++ b/definitions/scenarios/upgrade_to_satellite_6_16.rb @@ -98,6 +98,7 @@ def compose add_steps(find_checks(:default)) add_steps(find_checks(:post_upgrade)) add_step(Procedures::Packages::CheckForReboot) + add_step(Procedures::Pulpcore::ContainerHandleImageMetadata) end end end