Skip to content

Commit

Permalink
rhui(azure): hardcore client repoids changes for RHEL8.10 SAP
Browse files Browse the repository at this point in the history
  • Loading branch information
mhecko authored and Rezney committed Jun 7, 2024
1 parent 4024443 commit 6f20f5e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -16,6 +16,11 @@
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():
"""
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions repos/system_upgrade/common/libraries/rhui.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def mk_rhui_setup(clients=None, leapp_pkg='', mandatory_files=None, optional_fil
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)
Expand All @@ -289,7 +289,7 @@ def mk_rhui_setup(clients=None, leapp_pkg='', mandatory_files=None, optional_fil
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)
Expand Down

0 comments on commit 6f20f5e

Please sign in to comment.