leapp-repository/SOURCES/0003-Ensure-the-right-repositories-are-enabled-on-Satelli.patch

79 lines
3.7 KiB
Diff
Raw Normal View History

2022-05-18 11:41:20 +00:00
From a1fdabea9c00a96ffc1504577f12733e1c1830ee Mon Sep 17 00:00:00 2001
From: Evgeni Golov <evgeni@golov.de>
Date: Thu, 7 Apr 2022 14:56:18 +0200
Subject: [PATCH 3/3] Ensure the right repositories are enabled on Satellite
Capsules
---
.../actors/satellite_upgrade_facts/actor.py | 6 +++-
.../unit_test_satellite_upgrade_facts.py | 34 ++++++++++++++++++-
2 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/repos/system_upgrade/el7toel8/actors/satellite_upgrade_facts/actor.py b/repos/system_upgrade/el7toel8/actors/satellite_upgrade_facts/actor.py
index eb87cd68..fb83107e 100644
--- a/repos/system_upgrade/el7toel8/actors/satellite_upgrade_facts/actor.py
+++ b/repos/system_upgrade/el7toel8/actors/satellite_upgrade_facts/actor.py
@@ -129,6 +129,10 @@ class SatelliteUpgradeFacts(Actor):
modules_to_enable=modules_to_enable
)
)
- repositories_to_enable = ['ansible-2.9-for-rhel-8-x86_64-rpms', 'satellite-6.11-for-rhel-8-x86_64-rpms',
+ repositories_to_enable = ['ansible-2.9-for-rhel-8-x86_64-rpms',
'satellite-maintenance-6.11-for-rhel-8-x86_64-rpms']
+ if has_package(InstalledRPM, 'foreman'):
+ repositories_to_enable.append('satellite-6.11-for-rhel-8-x86_64-rpms')
+ else:
+ repositories_to_enable.append('satellite-capsule-6.11-for-rhel-8-x86_64-rpms')
self.produce(RepositoriesSetupTasks(to_enable=repositories_to_enable))
diff --git a/repos/system_upgrade/el7toel8/actors/satellite_upgrade_facts/tests/unit_test_satellite_upgrade_facts.py b/repos/system_upgrade/el7toel8/actors/satellite_upgrade_facts/tests/unit_test_satellite_upgrade_facts.py
index 5c8e79ff..e77b7b58 100644
--- a/repos/system_upgrade/el7toel8/actors/satellite_upgrade_facts/tests/unit_test_satellite_upgrade_facts.py
+++ b/repos/system_upgrade/el7toel8/actors/satellite_upgrade_facts/tests/unit_test_satellite_upgrade_facts.py
@@ -1,6 +1,14 @@
import os
-from leapp.models import DNFWorkaround, InstalledRPM, Module, RPM, RpmTransactionTasks, SatelliteFacts
+from leapp.models import (
+ DNFWorkaround,
+ InstalledRPM,
+ Module,
+ RepositoriesSetupTasks,
+ RPM,
+ RpmTransactionTasks,
+ SatelliteFacts
+)
from leapp.snactor.fixture import current_actor_context
RH_PACKAGER = 'Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>'
@@ -87,3 +95,27 @@ def test_detects_remote_postgresql(current_actor_context):
assert not satellitemsg.postgresql.local_postgresql
assert not current_actor_context.consume(DNFWorkaround)
+
+
+def test_enables_right_repositories_on_satellite(current_actor_context):
+ current_actor_context.feed(InstalledRPM(items=[FOREMAN_RPM]))
+ current_actor_context.run()
+
+ rpmmessage = current_actor_context.consume(RepositoriesSetupTasks)[0]
+
+ assert 'ansible-2.9-for-rhel-8-x86_64-rpms' in rpmmessage.to_enable
+ assert 'satellite-maintenance-6.11-for-rhel-8-x86_64-rpms' in rpmmessage.to_enable
+ assert 'satellite-6.11-for-rhel-8-x86_64-rpms' in rpmmessage.to_enable
+ assert 'satellite-capsule-6.11-for-rhel-8-x86_64-rpms' not in rpmmessage.to_enable
+
+
+def test_enables_right_repositories_on_capsule(current_actor_context):
+ current_actor_context.feed(InstalledRPM(items=[FOREMAN_PROXY_RPM]))
+ current_actor_context.run()
+
+ rpmmessage = current_actor_context.consume(RepositoriesSetupTasks)[0]
+
+ assert 'ansible-2.9-for-rhel-8-x86_64-rpms' in rpmmessage.to_enable
+ assert 'satellite-maintenance-6.11-for-rhel-8-x86_64-rpms' in rpmmessage.to_enable
+ assert 'satellite-6.11-for-rhel-8-x86_64-rpms' not in rpmmessage.to_enable
+ assert 'satellite-capsule-6.11-for-rhel-8-x86_64-rpms' in rpmmessage.to_enable
--
2.35.1