leapp-repository/0056-rhui-azure-hardcore-client-repoids-changes-for-RHEL8.patch

95 lines
5.0 KiB
Diff
Raw Normal View History

From 6f20f5e83eb9ad9fb2ae76e2e499f9e36632b31e Mon Sep 17 00:00:00 2001
From: mhecko <mhecko@redhat.com>
Date: Thu, 30 May 2024 22:08:37 +0200
Subject: [PATCH 56/92] rhui(azure): hardcore client repoids changes for
RHEL8.10 SAP
---
.../libraries/setuptargetrepos.py | 27 ++++++++++++++++++-
repos/system_upgrade/common/libraries/rhui.py | 4 +--
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/repos/system_upgrade/common/actors/setuptargetrepos/libraries/setuptargetrepos.py b/repos/system_upgrade/common/actors/setuptargetrepos/libraries/setuptargetrepos.py
index 2b14a29a..a6073aa3 100644
--- a/repos/system_upgrade/common/actors/setuptargetrepos/libraries/setuptargetrepos.py
+++ b/repos/system_upgrade/common/actors/setuptargetrepos/libraries/setuptargetrepos.py
@@ -1,6 +1,6 @@
from leapp.libraries.actor import setuptargetrepos_repomap
-from leapp.libraries.common.config.version import get_source_major_version
+from leapp.libraries.common.config.version import get_source_major_version, get_source_version, get_target_version
from leapp.libraries.stdlib import api
from leapp.models import (
CustomTargetRepository,
@@ -16,6 +16,11 @@ from leapp.models import (
UsedRepositories
)
+RHUI_CLIENT_REPOIDS_RHEL88_TO_RHEL810 = {
+ 'rhui-microsoft-azure-rhel8-sapapps': 'rhui-microsoft-azure-rhel8-base-sap-apps',
+ 'rhui-microsoft-azure-rhel8-sap-ha': 'rhui-microsoft-azure-rhel8-base-sap-ha',
+}
+
def _get_enabled_repoids():
"""
@@ -99,6 +104,16 @@ def process():
# can be used to upgrade installed packages.
repoids_to_map = enabled_repoids.union(repoids_from_installed_packages_with_mapping)
+ # RHEL8.10 use a different repoid for client repository, but the repomapping mechanism cannot distinguish these
+ # as it does not use minor versions. Therefore, we have to hardcode these changes.
+ if get_source_version() == '8.10':
+ for rhel88_rhui_client_repoid, rhel810_rhui_client_repoid in RHUI_CLIENT_REPOIDS_RHEL88_TO_RHEL810.items():
+ if rhel810_rhui_client_repoid in repoids_to_map:
+ # Replace RHEL8.10 rhui client repoids with RHEL8.8 repoids,
+ # so that they are mapped to target repoids correctly.
+ repoids_to_map.remove(rhel810_rhui_client_repoid)
+ repoids_to_map.add(rhel88_rhui_client_repoid)
+
# Set default repository channels for the repomap
# TODO(pstodulk): what about skip this completely and keep the default 'ga'..?
default_channels = setuptargetrepos_repomap.get_default_repository_channels(repomap, repoids_to_map)
@@ -138,6 +153,16 @@ def process():
continue
target_rhel_repoids.add(repo)
+ # On 8.10, some RHUI setups have different names than the one computed by repomapping.
+ # Although such situation could be avoided (having another client repo when a single
+ # repo can hold more than one RPM), we have to deal with it here. This is not a proper
+ # solution.
+ if get_target_version() == '8.10':
+ for pre_810_repoid, post_810_repoid in RHUI_CLIENT_REPOIDS_RHEL88_TO_RHEL810.items():
+ if pre_810_repoid in target_rhel_repoids:
+ target_rhel_repoids.remove(pre_810_repoid)
+ target_rhel_repoids.add(post_810_repoid)
+
# create the final lists and sort them (for easier testing)
rhel_repos = [RHELTargetRepository(repoid=repoid) for repoid in sorted(target_rhel_repoids)]
custom_repos = [repo for repo in custom_repos if repo.repoid not in excluded_repoids]
diff --git a/repos/system_upgrade/common/libraries/rhui.py b/repos/system_upgrade/common/libraries/rhui.py
index dc50bf45..28f1aeee 100644
--- a/repos/system_upgrade/common/libraries/rhui.py
+++ b/repos/system_upgrade/common/libraries/rhui.py
@@ -262,7 +262,7 @@ RHUI_SETUPS = {
extra_info={'agent_pkg': 'WALinuxAgent'},
os_version='8', content_channel=ContentChannel.EUS),
mk_rhui_setup(clients={'rhui-azure-rhel8-base-sap-apps'}, leapp_pkg='leapp-rhui-azure-sap',
- mandatory_files=[('leapp-azure-sap-apps.repo', YUM_REPOS_PATH)],
+ mandatory_files=[('leapp-azure-base-sap-apps.repo', YUM_REPOS_PATH)],
optional_files=[
('key-sapapps.pem', RHUI_PKI_DIR),
('content-sapapps.crt', RHUI_PKI_PRODUCT_DIR)
@@ -289,7 +289,7 @@ RHUI_SETUPS = {
extra_info={'agent_pkg': 'WALinuxAgent'},
os_version='8', content_channel=ContentChannel.E4S),
mk_rhui_setup(clients={'rhui-azure-rhel8-base-sap-ha'}, leapp_pkg='leapp-rhui-azure-sap',
- mandatory_files=[('leapp-azure-sap-ha.repo', YUM_REPOS_PATH)],
+ mandatory_files=[('leapp-azure-base-sap-ha.repo', YUM_REPOS_PATH)],
optional_files=[
('key-sap-ha.pem', RHUI_PKI_DIR),
('content-sap-ha.crt', RHUI_PKI_PRODUCT_DIR)
--
2.42.0