forked from rpms/leapp-repository
79ca77ccf4
- 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
113 lines
6.6 KiB
Diff
113 lines
6.6 KiB
Diff
From 720bb13c5eb411469e8bf825b93aeefdc771f039 Mon Sep 17 00:00:00 2001
|
|
From: Evgeni Golov <evgeni@golov.de>
|
|
Date: Wed, 24 Apr 2024 13:58:39 +0200
|
|
Subject: [PATCH 29/34] Refresh collation version if pulp-ansible is present
|
|
|
|
When migrating to a new OS, we REINDEX all databases.
|
|
pulp_ansible ships with an own collation (using ICU), which needs a
|
|
version refresh after the REINDEX has been done.
|
|
---
|
|
.../common/actors/satellite_upgrader/actor.py | 4 ++++
|
|
.../tests/unit_test_satellite_upgrader.py | 18 ++++++++++++++++++
|
|
.../system_upgrade/common/models/satellite.py | 2 ++
|
|
.../actors/satellite_upgrade_facts/actor.py | 1 +
|
|
.../tests/unit_test_satellite_upgrade_facts.py | 9 +++++++++
|
|
5 files changed, 34 insertions(+)
|
|
|
|
diff --git a/repos/system_upgrade/common/actors/satellite_upgrader/actor.py b/repos/system_upgrade/common/actors/satellite_upgrader/actor.py
|
|
index f498f2fa..2e0290ae 100644
|
|
--- a/repos/system_upgrade/common/actors/satellite_upgrader/actor.py
|
|
+++ b/repos/system_upgrade/common/actors/satellite_upgrader/actor.py
|
|
@@ -25,6 +25,10 @@ class SatelliteUpgrader(Actor):
|
|
run(['sed', '-i', '/data_directory/d', '/var/lib/pgsql/data/postgresql.conf'])
|
|
run(['systemctl', 'start', 'postgresql'])
|
|
run(['runuser', '-u', 'postgres', '--', 'reindexdb', '-a'])
|
|
+ if facts.postgresql.has_pulp_ansible_semver:
|
|
+ run(['runuser', '-c',
|
|
+ 'echo "ALTER COLLATION pulp_ansible_semver REFRESH VERSION;" | psql pulpcore',
|
|
+ 'postgres'])
|
|
except CalledProcessError as e:
|
|
api.current_logger().error('Failed to reindex the database: {}'.format(str(e)))
|
|
|
|
diff --git a/repos/system_upgrade/common/actors/satellite_upgrader/tests/unit_test_satellite_upgrader.py b/repos/system_upgrade/common/actors/satellite_upgrader/tests/unit_test_satellite_upgrader.py
|
|
index 2f3509f3..55896c75 100644
|
|
--- a/repos/system_upgrade/common/actors/satellite_upgrader/tests/unit_test_satellite_upgrader.py
|
|
+++ b/repos/system_upgrade/common/actors/satellite_upgrader/tests/unit_test_satellite_upgrader.py
|
|
@@ -48,3 +48,21 @@ def test_run_reindexdb(monkeypatch, current_actor_context):
|
|
assert mocked_run.commands[1] == ['systemctl', 'start', 'postgresql']
|
|
assert mocked_run.commands[2] == ['runuser', '-u', 'postgres', '--', 'reindexdb', '-a']
|
|
assert mocked_run.commands[3] == ['foreman-installer', '--disable-system-checks']
|
|
+
|
|
+
|
|
+def test_run_reindexdb_with_pulp_ansible(monkeypatch, current_actor_context):
|
|
+ mocked_run = MockedRun()
|
|
+ monkeypatch.setattr('leapp.libraries.stdlib.run', mocked_run)
|
|
+ current_actor_context.feed(SatelliteFacts(has_foreman=True,
|
|
+ postgresql=SatellitePostgresqlFacts(local_postgresql=True,
|
|
+ has_pulp_ansible_semver=True)))
|
|
+ current_actor_context.run()
|
|
+ assert mocked_run.commands
|
|
+ assert len(mocked_run.commands) == 5
|
|
+ assert mocked_run.commands[0] == ['sed', '-i', '/data_directory/d', '/var/lib/pgsql/data/postgresql.conf']
|
|
+ assert mocked_run.commands[1] == ['systemctl', 'start', 'postgresql']
|
|
+ assert mocked_run.commands[2] == ['runuser', '-u', 'postgres', '--', 'reindexdb', '-a']
|
|
+ assert mocked_run.commands[3] == ['runuser', '-c',
|
|
+ 'echo "ALTER COLLATION pulp_ansible_semver REFRESH VERSION;" | psql pulpcore',
|
|
+ 'postgres']
|
|
+ assert mocked_run.commands[4] == ['foreman-installer', '--disable-system-checks']
|
|
diff --git a/repos/system_upgrade/common/models/satellite.py b/repos/system_upgrade/common/models/satellite.py
|
|
index b4282790..532f6a3a 100644
|
|
--- a/repos/system_upgrade/common/models/satellite.py
|
|
+++ b/repos/system_upgrade/common/models/satellite.py
|
|
@@ -15,6 +15,8 @@ class SatellitePostgresqlFacts(Model):
|
|
""" How many bytes are required on the target partition """
|
|
space_available = fields.Nullable(fields.Integer())
|
|
""" How many bytes are available on the target partition """
|
|
+ has_pulp_ansible_semver = fields.Boolean(default=False)
|
|
+ """ Whether the DB has the pulp_ansible_semver collation """
|
|
|
|
|
|
class SatelliteFacts(Model):
|
|
diff --git a/repos/system_upgrade/el8toel9/actors/satellite_upgrade_facts/actor.py b/repos/system_upgrade/el8toel9/actors/satellite_upgrade_facts/actor.py
|
|
index 2dc78cce..46612876 100644
|
|
--- a/repos/system_upgrade/el8toel9/actors/satellite_upgrade_facts/actor.py
|
|
+++ b/repos/system_upgrade/el8toel9/actors/satellite_upgrade_facts/actor.py
|
|
@@ -57,6 +57,7 @@ class SatelliteUpgradeFacts(Actor):
|
|
has_katello_installer=False,
|
|
postgresql=SatellitePostgresqlFacts(
|
|
local_postgresql=local_postgresql,
|
|
+ has_pulp_ansible_semver=has_package(InstalledRPM, 'python3.11-pulp-ansible'),
|
|
),
|
|
))
|
|
|
|
diff --git a/repos/system_upgrade/el8toel9/actors/satellite_upgrade_facts/tests/unit_test_satellite_upgrade_facts.py b/repos/system_upgrade/el8toel9/actors/satellite_upgrade_facts/tests/unit_test_satellite_upgrade_facts.py
|
|
index b0e44c46..e7ca512e 100644
|
|
--- a/repos/system_upgrade/el8toel9/actors/satellite_upgrade_facts/tests/unit_test_satellite_upgrade_facts.py
|
|
+++ b/repos/system_upgrade/el8toel9/actors/satellite_upgrade_facts/tests/unit_test_satellite_upgrade_facts.py
|
|
@@ -26,6 +26,7 @@ RUBYGEM_FOREMAN_PUPPET_RPM = fake_package('rubygem-foreman_puppet')
|
|
POSTGRESQL_RPM = fake_package('postgresql-server')
|
|
SATELLITE_RPM = fake_package('satellite')
|
|
SATELLITE_CAPSULE_RPM = fake_package('satellite-capsule')
|
|
+PULP_ANSIBLE_RPM = fake_package('python3.11-pulp-ansible')
|
|
|
|
SATELLITE_REPOSITORY = UsedRepository(repository='satellite-6.99-for-rhel-8-x86_64-rpms')
|
|
CAPSULE_REPOSITORY = UsedRepository(repository='satellite-capsule-6.99-for-rhel-8-x86_64-rpms')
|
|
@@ -118,6 +119,14 @@ def test_detects_remote_postgresql(current_actor_context):
|
|
assert not satellitemsg.postgresql.local_postgresql
|
|
|
|
|
|
+def test_detects_pulp_ansible(current_actor_context):
|
|
+ current_actor_context.feed(InstalledRPM(items=[FOREMAN_RPM, POSTGRESQL_RPM, PULP_ANSIBLE_RPM]))
|
|
+ current_actor_context.run(config_model=mock_configs.CONFIG)
|
|
+
|
|
+ satellitemsg = current_actor_context.consume(SatelliteFacts)[0]
|
|
+ assert satellitemsg.postgresql.has_pulp_ansible_semver
|
|
+
|
|
+
|
|
def test_enables_right_repositories_on_satellite(current_actor_context):
|
|
current_actor_context.feed(InstalledRPM(items=[FOREMAN_RPM, SATELLITE_RPM]))
|
|
current_actor_context.feed(UsedRepositories(repositories=[SATELLITE_REPOSITORY, MAINTENANCE_REPOSITORY]))
|
|
--
|
|
2.42.0
|
|
|