leapp-repository/0027-Move-common-Satellite-Upgrade-code-to-common.patch
Toshio Kuratomi 79ca77ccf4 LEAPP-repository CTC1 Release for 8.10/9.5
- Do not terminate the upgrade dracut module execution if
  /sysroot/root/tmp_leapp_py3/.leapp_upgrade_failed exists
- Several minor improvements in messages printed in console output
- Several minor improvements in report and error messages
- Fix the parsing of the lscpu output
- Fix evaluation of PES data
- Target by default always "GA" channel repositories unless a different
  channel is specified for the leapp execution
- Fix creation of the post upgrade report about changes in states of systemd
  services
- Update the device driver deprecation data, fixing invalid fields for some
  AMD CPUs
- Update the default kernel cmdline
- Wait for the storage initialization when /usr is on separate file system -
  covering SAN
- Resolves: RHEL-27847, RHEL-35240
2024-05-13 10:59:28 -07:00

111 lines
5.3 KiB
Diff

From 88126ef33db2094b89fc17ad9e9a3962a9bb7d65 Mon Sep 17 00:00:00 2001
From: Evgeni Golov <evgeni@golov.de>
Date: Mon, 19 Feb 2024 12:09:05 +0100
Subject: [PATCH 27/34] Move common Satellite Upgrade code to "common"
This allows the re-use of the code in the el8toel9 upgrade.
---
.../satellite_upgrade_services/actor.py | 35 +++++++++++++++++++
.../actors/satellite_upgrader/actor.py | 0
.../tests/unit_test_satellite_upgrader.py | 0
.../{el7toel8 => common}/models/satellite.py | 0
.../satellite_upgrade_data_migration/actor.py | 15 +-------
5 files changed, 36 insertions(+), 14 deletions(-)
create mode 100644 repos/system_upgrade/common/actors/satellite_upgrade_services/actor.py
rename repos/system_upgrade/{el7toel8 => common}/actors/satellite_upgrader/actor.py (100%)
rename repos/system_upgrade/{el7toel8 => common}/actors/satellite_upgrader/tests/unit_test_satellite_upgrader.py (100%)
rename repos/system_upgrade/{el7toel8 => common}/models/satellite.py (100%)
diff --git a/repos/system_upgrade/common/actors/satellite_upgrade_services/actor.py b/repos/system_upgrade/common/actors/satellite_upgrade_services/actor.py
new file mode 100644
index 00000000..3cda49a9
--- /dev/null
+++ b/repos/system_upgrade/common/actors/satellite_upgrade_services/actor.py
@@ -0,0 +1,35 @@
+import glob
+import os
+
+from leapp.actors import Actor
+from leapp.models import SatelliteFacts
+from leapp.tags import ApplicationsPhaseTag, IPUWorkflowTag
+
+SYSTEMD_WANTS_BASE = '/etc/systemd/system/multi-user.target.wants/'
+SERVICES_TO_DISABLE = ['dynflow-sidekiq@*', 'foreman', 'foreman-proxy',
+ 'httpd', 'postgresql', 'pulpcore-api', 'pulpcore-content',
+ 'pulpcore-worker@*', 'tomcat', 'redis']
+
+
+class SatelliteUpgradeServices(Actor):
+ """
+ Reconfigure Satellite services
+ """
+
+ name = 'satellite_upgrade_services'
+ consumes = (SatelliteFacts,)
+ produces = ()
+ tags = (IPUWorkflowTag, ApplicationsPhaseTag)
+
+ def process(self):
+ facts = next(self.consume(SatelliteFacts), None)
+ if not facts or not facts.has_foreman:
+ return
+
+ # disable services, will be re-enabled by the installer
+ for service_name in SERVICES_TO_DISABLE:
+ for service in glob.glob(os.path.join(SYSTEMD_WANTS_BASE, '{}.service'.format(service_name))):
+ try:
+ os.unlink(service)
+ except OSError as e:
+ self.log.warning('Failed disabling service {}: {}'.format(service, e))
diff --git a/repos/system_upgrade/el7toel8/actors/satellite_upgrader/actor.py b/repos/system_upgrade/common/actors/satellite_upgrader/actor.py
similarity index 100%
rename from repos/system_upgrade/el7toel8/actors/satellite_upgrader/actor.py
rename to repos/system_upgrade/common/actors/satellite_upgrader/actor.py
diff --git a/repos/system_upgrade/el7toel8/actors/satellite_upgrader/tests/unit_test_satellite_upgrader.py b/repos/system_upgrade/common/actors/satellite_upgrader/tests/unit_test_satellite_upgrader.py
similarity index 100%
rename from repos/system_upgrade/el7toel8/actors/satellite_upgrader/tests/unit_test_satellite_upgrader.py
rename to repos/system_upgrade/common/actors/satellite_upgrader/tests/unit_test_satellite_upgrader.py
diff --git a/repos/system_upgrade/el7toel8/models/satellite.py b/repos/system_upgrade/common/models/satellite.py
similarity index 100%
rename from repos/system_upgrade/el7toel8/models/satellite.py
rename to repos/system_upgrade/common/models/satellite.py
diff --git a/repos/system_upgrade/el7toel8/actors/satellite_upgrade_data_migration/actor.py b/repos/system_upgrade/el7toel8/actors/satellite_upgrade_data_migration/actor.py
index 0cf66970..1dd52691 100644
--- a/repos/system_upgrade/el7toel8/actors/satellite_upgrade_data_migration/actor.py
+++ b/repos/system_upgrade/el7toel8/actors/satellite_upgrade_data_migration/actor.py
@@ -11,15 +11,10 @@ POSTGRESQL_SCL_DATA_PATH = '/var/opt/rh/rh-postgresql12/lib/pgsql/data/'
POSTGRESQL_USER = 'postgres'
POSTGRESQL_GROUP = 'postgres'
-SYSTEMD_WANTS_BASE = '/etc/systemd/system/multi-user.target.wants/'
-SERVICES_TO_DISABLE = ['dynflow-sidekiq@*', 'foreman', 'foreman-proxy',
- 'httpd', 'postgresql', 'pulpcore-api', 'pulpcore-content',
- 'pulpcore-worker@*', 'tomcat']
-
class SatelliteUpgradeDataMigration(Actor):
"""
- Reconfigure Satellite services and migrate PostgreSQL data
+ Migrate Satellite PostgreSQL data
"""
name = 'satellite_upgrade_data_migration'
@@ -32,14 +27,6 @@ class SatelliteUpgradeDataMigration(Actor):
if not facts or not facts.has_foreman:
return
- # disable services, will be re-enabled by the installer
- for service_name in SERVICES_TO_DISABLE:
- for service in glob.glob(os.path.join(SYSTEMD_WANTS_BASE, '{}.service'.format(service_name))):
- try:
- os.unlink(service)
- except Exception as e: # pylint: disable=broad-except
- self.log.warning('Failed disabling service {}: {}'.format(service, e))
-
if facts.postgresql.local_postgresql and os.path.exists(POSTGRESQL_SCL_DATA_PATH):
# we can assume POSTGRESQL_DATA_PATH exists and is empty
# move PostgreSQL data to the new home
--
2.42.0