From 6ab7f341c706ca32f8344c214e421e43fe657bae Mon Sep 17 00:00:00 2001 From: Matej Matuska Date: Thu, 21 Aug 2025 12:13:14 +0200 Subject: [PATCH 091/111] lib/rhui: Remove deprecated code and setups map --- .../tests/component_test_checkrhui.py | 10 - repos/system_upgrade/common/libraries/rhui.py | 250 ------------------ 2 files changed, 260 deletions(-) diff --git a/repos/system_upgrade/common/actors/cloud/checkrhui/tests/component_test_checkrhui.py b/repos/system_upgrade/common/actors/cloud/checkrhui/tests/component_test_checkrhui.py index 7fa2112f..f0820c86 100644 --- a/repos/system_upgrade/common/actors/cloud/checkrhui/tests/component_test_checkrhui.py +++ b/repos/system_upgrade/common/actors/cloud/checkrhui/tests/component_test_checkrhui.py @@ -53,16 +53,6 @@ def mk_setup_info(): return TargetRHUISetupInfo(preinstall_tasks=pre_tasks, postinstall_tasks=post_tasks) -def iter_known_rhui_setups(): - for upgrade_path, providers in rhui.RHUI_CLOUD_MAP.items(): - for provider_variant, variant_description in providers.items(): - src_clients = variant_description['src_pkg'] - if isinstance(src_clients, str): - src_clients = {src_clients, } - - yield provider_variant, upgrade_path, src_clients - - def mk_cloud_map(variants): upg_path = {} for variant_desc in variants: diff --git a/repos/system_upgrade/common/libraries/rhui.py b/repos/system_upgrade/common/libraries/rhui.py index e200075f..7639a64f 100644 --- a/repos/system_upgrade/common/libraries/rhui.py +++ b/repos/system_upgrade/common/libraries/rhui.py @@ -1,12 +1,8 @@ import os from collections import namedtuple -import six - from leapp.libraries.common.config import architecture as arch from leapp.libraries.common.config.version import get_source_major_version, get_target_major_version -from leapp.libraries.stdlib import api -from leapp.utils.deprecation import deprecated DNF_PLUGIN_PATH_PY2 = '/usr/lib/python2.7/site-packages/dnf-plugins/' YUM_REPOS_PATH = '/etc/yum.repos.d' @@ -435,220 +431,6 @@ RHUI_SETUPS = { } -# DEPRECATED, use RHUI_SETUPS instead -RHUI_CLOUD_MAP = { - '7to8': { - 'aws': { - 'src_pkg': 'rh-amazon-rhui-client', - 'target_pkg': 'rh-amazon-rhui-client', - 'leapp_pkg': 'leapp-rhui-aws', - 'leapp_pkg_repo': 'leapp-aws.repo', - 'files_map': [ - ('rhui-client-config-server-8.crt', RHUI_PKI_PRODUCT_DIR), - ('rhui-client-config-server-8.key', RHUI_PKI_DIR), - ('cdn.redhat.com-chain.crt', RHUI_PKI_DIR), - (AWS_DNF_PLUGIN_NAME, DNF_PLUGIN_PATH_PY2), - ('leapp-aws.repo', YUM_REPOS_PATH) - ], - }, - 'aws-sap-e4s': { - 'src_pkg': 'rh-amazon-rhui-client-sap-bundle', - 'target_pkg': 'rh-amazon-rhui-client-sap-bundle-e4s', - 'leapp_pkg': 'leapp-rhui-aws-sap-e4s', - 'leapp_pkg_repo': 'leapp-aws-sap-e4s.repo', - 'files_map': [ - ('rhui-client-config-server-8-sap-bundle.crt', RHUI_PKI_PRODUCT_DIR), - ('rhui-client-config-server-8-sap-bundle.key', RHUI_PKI_DIR), - ('cdn.redhat.com-chain.crt', RHUI_PKI_DIR), - (AWS_DNF_PLUGIN_NAME, DNF_PLUGIN_PATH_PY2), - ('leapp-aws-sap-e4s.repo', YUM_REPOS_PATH) - ], - }, - 'azure': { - 'src_pkg': 'rhui-azure-rhel7', - 'target_pkg': 'rhui-azure-rhel8', - 'agent_pkg': 'WALinuxAgent', - 'leapp_pkg': 'leapp-rhui-azure', - 'leapp_pkg_repo': 'leapp-azure.repo', - 'files_map': [ - ('leapp-azure.repo', YUM_REPOS_PATH) - ], - }, - 'azure-sap-apps': { - 'src_pkg': 'rhui-azure-rhel7-base-sap-apps', - 'target_pkg': 'rhui-azure-rhel8-sapapps', - 'agent_pkg': 'WALinuxAgent', - 'leapp_pkg': 'leapp-rhui-azure-sap', - 'leapp_pkg_repo': 'leapp-azure-sap-apps.repo', - 'files_map': [ - ('leapp-azure-sap-apps.repo', YUM_REPOS_PATH), - ], - }, - 'azure-sap-ha': { - 'src_pkg': 'rhui-azure-rhel7-base-sap-ha', - 'target_pkg': 'rhui-azure-rhel8-sap-ha', - 'agent_pkg': 'WALinuxAgent', - 'leapp_pkg': 'leapp-rhui-azure-sap', - 'leapp_pkg_repo': 'leapp-azure-sap-ha.repo', - 'files_map': [ - ('leapp-azure-sap-ha.repo', YUM_REPOS_PATH) - ], - }, - 'google': { - 'src_pkg': 'google-rhui-client-rhel7', - 'target_pkg': 'google-rhui-client-rhel8', - 'leapp_pkg': 'leapp-rhui-google', - 'leapp_pkg_repo': 'leapp-google.repo', - 'files_map': [ - ('content.crt', RHUI_PKI_PRODUCT_DIR), - ('key.pem', RHUI_PKI_DIR), - ('leapp-google.repo', YUM_REPOS_PATH) - ], - }, - 'google-sap': { - 'src_pkg': 'google-rhui-client-rhel79-sap', - 'target_pkg': 'google-rhui-client-rhel8-sap', - 'leapp_pkg': 'leapp-rhui-google-sap', - 'leapp_pkg_repo': 'leapp-google-sap.repo', - 'files_map': [ - ('content.crt', RHUI_PKI_PRODUCT_DIR), - ('key.pem', RHUI_PKI_DIR), - ('leapp-google-sap.repo', YUM_REPOS_PATH) - ], - }, - 'alibaba': { - 'src_pkg': 'client-rhel7', - 'target_pkg': 'aliyun_rhui_rhel8', - 'leapp_pkg': 'leapp-rhui-alibaba', - 'leapp_pkg_repo': 'leapp-alibaba.repo', - 'files_map': [ - ('content.crt', RHUI_PKI_PRODUCT_DIR), - ('key.pem', RHUI_PKI_DIR), - ('leapp-alibaba.repo', YUM_REPOS_PATH) - ], - } - }, - '8to9': { - 'aws': { - 'src_pkg': 'rh-amazon-rhui-client', - 'target_pkg': 'rh-amazon-rhui-client', - 'leapp_pkg': 'leapp-rhui-aws', - 'leapp_pkg_repo': 'leapp-aws.repo', - 'files_map': [ - ('rhui-client-config-server-9.crt', RHUI_PKI_PRODUCT_DIR), - ('rhui-client-config-server-9.key', RHUI_PKI_DIR), - ('cdn.redhat.com-chain.crt', RHUI_PKI_DIR), - ('leapp-aws.repo', YUM_REPOS_PATH) - ], - }, - 'aws-sap-e4s': { - 'src_pkg': 'rh-amazon-rhui-client-sap-bundle-e4s', - 'target_pkg': 'rh-amazon-rhui-client-sap-bundle-e4s', - 'leapp_pkg': 'leapp-rhui-aws-sap-e4s', - 'leapp_pkg_repo': 'leapp-aws-sap-e4s.repo', - 'files_map': [ - ('rhui-client-config-server-9-sap-bundle.crt', RHUI_PKI_PRODUCT_DIR), - ('rhui-client-config-server-9-sap-bundle.key', RHUI_PKI_DIR), - ('cdn.redhat.com-chain.crt', RHUI_PKI_DIR), - ('leapp-aws-sap-e4s.repo', YUM_REPOS_PATH) - ], - }, - 'azure': { - 'src_pkg': 'rhui-azure-rhel8', - 'target_pkg': 'rhui-azure-rhel9', - 'agent_pkg': 'WALinuxAgent', - 'leapp_pkg': 'leapp-rhui-azure', - 'leapp_pkg_repo': 'leapp-azure.repo', - 'files_map': [ - ('leapp-azure.repo', YUM_REPOS_PATH) - ], - }, - # FIXME(mhecko): This entry is identical to the azure one, since we have no EUS content yet, therefore, it - # # serves only the purpose of containing the name of rhui client package to correctly detect - # # cloud provider. Trying to work around this entry by specifying --channel, will result in - # # failures - there is no repomapping for EUS content, and the name of target pkg differs on EUS. - # # If the EUS image is available sooner than the 'azure-eus' entry gets modified, the user can - # # still upgrade to non-EUS, and switch the newly upgraded system to EUS manually. - 'azure-eus': { - 'src_pkg': 'rhui-azure-rhel8-eus', - 'target_pkg': 'rhui-azure-rhel9', - 'agent_pkg': 'WALinuxAgent', - 'leapp_pkg': 'leapp-rhui-azure-eus', - 'leapp_pkg_repo': 'leapp-azure.repo', - 'files_map': [ - ('leapp-azure.repo', YUM_REPOS_PATH) - ], - }, - 'azure-sap-ha': { - 'src_pkg': 'rhui-azure-rhel8-sap-ha', - 'target_pkg': 'rhui-azure-rhel9-sap-ha', - 'agent_pkg': 'WALinuxAgent', - 'leapp_pkg': 'leapp-rhui-azure-sap', - 'leapp_pkg_repo': 'leapp-azure-sap-ha.repo', - 'files_map': [ - ('leapp-azure-sap-ha.repo', YUM_REPOS_PATH) - ], - }, - 'azure-sap-apps': { - 'src_pkg': 'rhui-azure-rhel8-sapapps', - 'target_pkg': 'rhui-azure-rhel9-sapapps', - 'agent_pkg': 'WALinuxAgent', - 'leapp_pkg': 'leapp-rhui-azure-sap', - 'leapp_pkg_repo': 'leapp-azure-sap-apps.repo', - 'files_map': [ - ('leapp-azure-sap-apps.repo', YUM_REPOS_PATH) - ], - }, - 'google': { - 'src_pkg': 'google-rhui-client-rhel8', - 'target_pkg': 'google-rhui-client-rhel9', - 'leapp_pkg': 'leapp-rhui-google', - 'leapp_pkg_repo': 'leapp-google.repo', - 'files_map': [ - ('content.crt', RHUI_PKI_PRODUCT_DIR), - ('key.pem', RHUI_PKI_DIR), - ('leapp-google.repo', YUM_REPOS_PATH) - ], - }, - 'google-sap': { - 'src_pkg': 'google-rhui-client-rhel8-sap', - 'target_pkg': 'google-rhui-client-rhel9-sap', - 'leapp_pkg': 'leapp-rhui-google-sap', - 'leapp_pkg_repo': 'leapp-google-sap.repo', - 'files_map': [ - ('content.crt', RHUI_PKI_PRODUCT_DIR), - ('key.pem', RHUI_PKI_DIR), - ('leapp-google-sap.repo', YUM_REPOS_PATH) - ], - }, - 'alibaba': { - 'src_pkg': 'aliyun_rhui_rhel8', - 'target_pkg': 'aliyun_rhui_rhel9', - 'leapp_pkg': 'leapp-rhui-alibaba', - 'leapp_pkg_repo': 'leapp-alibaba.repo', - 'files_map': [ - ('content.crt', RHUI_PKI_PRODUCT_DIR), - ('key.pem', RHUI_PKI_DIR), - ('leapp-alibaba.repo', YUM_REPOS_PATH) - ], - }, - }, - '9to10': { - 'alibaba': { - 'src_pkg': 'aliyun_rhui_rhel9', - 'target_pkg': 'aliyun_rhui_rhel10', - 'leapp_pkg': 'leapp-rhui-alibaba', - 'leapp_pkg_repo': 'leapp-alibaba.repo', - 'files_map': [ - ('content.crt', RHUI_PKI_PRODUCT_DIR), - ('key.pem', RHUI_PKI_DIR), - ('leapp-alibaba.repo', YUM_REPOS_PATH) - ], - }, - } -} - - def get_upg_path(): """ Get upgrade path in specific string format @@ -658,38 +440,6 @@ def get_upg_path(): return '{0}to{1}'.format(source_major_version, target_major_version) -@deprecated(since='2023-07-27', message='This functionality has been replaced with the RHUIInfo message.') -def gen_rhui_files_map(): - """ - Generate RHUI files map based on architecture and upgrade path - """ - arch = api.current_actor().configuration.architecture - upg_path = get_upg_path() - - cloud_map = RHUI_CLOUD_MAP - # for the moment the only arch related difference in RHUI package naming is on ARM - if arch == 'aarch64': - cloud_map[get_upg_path()]['aws']['src_pkg'] = 'rh-amazon-rhui-client-arm' - - files_map = dict((k, v['files_map']) for k, v in six.iteritems(cloud_map[upg_path])) - return files_map - - -@deprecated(since='2023-07-27', message='This functionality has been integrated into target_userspace_creator.') -def copy_rhui_data(context, provider): - """ - Copy relevant RHUI certificates and key into the target userspace container - """ - rhui_dir = api.get_common_folder_path('rhui') - data_dir = os.path.join(rhui_dir, provider) - - context.call(['mkdir', '-p', RHUI_PKI_PRODUCT_DIR]) - context.call(['mkdir', '-p', RHUI_PKI_PRIVATE_DIR]) - - for path_ in gen_rhui_files_map().get(provider, ()): - context.copy_to(os.path.join(data_dir, path_[0]), path_[1]) - - def get_all_known_rhui_pkgs_for_current_upg(): upg_major_versions = (get_source_major_version(), get_target_major_version()) -- 2.52.0