From 2a52960a51bd1107a5712d118cae6f3088148437 Mon Sep 17 00:00:00 2001 From: Oleksandr Shyshatskyi Date: Tue, 21 Jan 2025 13:30:04 +0200 Subject: [PATCH 1/9] add cloudlinux to list of 8 -> 9 upgrade support --- repos/system_upgrade/common/libraries/config/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repos/system_upgrade/common/libraries/config/version.py b/repos/system_upgrade/common/libraries/config/version.py index 4ebbdf4d9d..337ff8cd2f 100644 --- a/repos/system_upgrade/common/libraries/config/version.py +++ b/repos/system_upgrade/common/libraries/config/version.py @@ -16,7 +16,7 @@ _SUPPORTED_VERSIONS = { # Note: 'rhel-alt' is detected when on 'rhel' with kernel 4.x '7': {'rhel': ['7.9'], 'rhel-alt': [], 'rhel-saphana': ['7.9'], 'centos': ['7.9'], 'eurolinux': ['7.9'], 'ol': ['7.9'], 'scientific': ['7.9'], 'cloudlinux': ['7.9']}, - '8': {'rhel': ['8.8', '8.10'], 'rhel-saphana': ['8.8', '8.10'], 'centos': ['8.5', '8.999'], 'almalinux': ['8.6', '8.7', '8.8', '8.9', '8.10'], 'eurolinux': ['8.6', '8.7', '8.8', '8.9', '8.10'], 'ol': ['8.6', '8.7', '8.8', '8.9', '8.10'], 'rocky': ['8.6', '8.7', '8.8', '8.9', '8.10']}, + '8': {'rhel': ['8.8', '8.10'], 'rhel-saphana': ['8.8', '8.10'], 'centos': ['8.5', '8.999'], 'almalinux': ['8.6', '8.7', '8.8', '8.9', '8.10'], 'eurolinux': ['8.6', '8.7', '8.8', '8.9', '8.10'], 'ol': ['8.6', '8.7', '8.8', '8.9', '8.10'], 'rocky': ['8.6', '8.7', '8.8', '8.9', '8.10'], 'cloudlinux': ['8.10']}, } From ca92dc2e7ddec36a166e9680bcdaf3b020e28daa Mon Sep 17 00:00:00 2001 From: Oleksandr Shyshatskyi Date: Wed, 22 Jan 2025 14:06:47 +0200 Subject: [PATCH 2/9] fix cloudlinux-release installation on cl9 --- .../targetuserspacecreator/libraries/userspacegen.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py b/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py index 5345297433..9f021d8c14 100644 --- a/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py +++ b/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py @@ -215,8 +215,8 @@ def _handle_transaction_err_msg_size(err): def enable_spacewalk_module(context): - enabled_repos = ["cloudlinux8-baseos"] target_major_version = get_target_major_version() + enabled_repos = ["cloudlinux{version}-baseos".format(version=target_major_version)] repos_opt = [['--enablerepo', repo] for repo in enabled_repos] repos_opt = list(itertools.chain(*repos_opt)) @@ -260,8 +260,13 @@ def prepare_target_userspace(context, userspace_dir, enabled_repos, packages): _import_gpg_keys(context, install_root_dir, target_major_version) api.current_logger().debug('Installing cloudlinux-release') - context.call(['rpm', '--import', 'https://repo.cloudlinux.com/cloudlinux/security/RPM-GPG-KEY-CloudLinux'], callback_raw=utils.logging_handler) - context.call(['dnf', '-y', 'localinstall', 'https://repo.cloudlinux.com/cloudlinux/migrate/release-files/cloudlinux/8/x86_64/cloudlinux8-release-current.x86_64.rpm'], callback_raw=utils.logging_handler) + context.call(['rpm', '--import', 'https://repo.cloudlinux.com/cloudlinux/security/RPM-GPG-KEY-CloudLinux'], + callback_raw=utils.logging_handler) + cloudlinux_release_url = 'https://repo.cloudlinux.com/cloudlinux/migrate/release-files' \ + '/cloudlinux/{version}/x86_64/cloudlinux{version}-release-current.x86_64.rpm' \ + ''.format(version=target_major_version) + context.call(['dnf', '-y', 'localinstall', cloudlinux_release_url], + callback_raw=utils.logging_handler) enable_spacewalk_module(context) From 594e091d4ae003b51719855c91a960429a653cba Mon Sep 17 00:00:00 2001 From: Oleksandr Shyshatskyi Date: Wed, 22 Jan 2025 14:06:57 +0200 Subject: [PATCH 3/9] enable spacewalk module only for cl8 --- .../actors/targetuserspacecreator/libraries/userspacegen.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py b/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py index 9f021d8c14..5be29e67ad 100644 --- a/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py +++ b/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py @@ -268,7 +268,9 @@ def prepare_target_userspace(context, userspace_dir, enabled_repos, packages): context.call(['dnf', '-y', 'localinstall', cloudlinux_release_url], callback_raw=utils.logging_handler) - enable_spacewalk_module(context) + # cloudlinux 9 does not have modular packages + if target_major_version == '8': + enable_spacewalk_module(context) api.current_logger().debug('Installing packages into target userspace: {}'.format(packages)) From f1e9f337083748ad0bda72c2fb790cdb3d026c4f Mon Sep 17 00:00:00 2001 From: Oleksandr Shyshatskyi Date: Wed, 22 Jan 2025 20:29:51 +0200 Subject: [PATCH 4/9] add cloudlinux actors to cl8 package --- packaging/leapp-repository.spec | 2 -- 1 file changed, 2 deletions(-) diff --git a/packaging/leapp-repository.spec b/packaging/leapp-repository.spec index 19047e01d4..2e6f5d2e86 100644 --- a/packaging/leapp-repository.spec +++ b/packaging/leapp-repository.spec @@ -240,8 +240,6 @@ rm -rf %{buildroot}%{leapp_python_sitelib}/leapp/cli/commands/tests rm -rf %{buildroot}%{repositorydir}/system_upgrade/el8toel9 %else rm -rf %{buildroot}%{repositorydir}/system_upgrade/el7toel8 -# CloudLinux migration only supports el7 to el8 -rm -rf %{buildroot}%{repositorydir}/system_upgrade/cloudlinux %endif # remove component/unit tests, Makefiles, ... stuff that related to testing only From e93450facae30b3b441ad6a9811e51cc7cd15b67 Mon Sep 17 00:00:00 2001 From: Oleksandr Shyshatskyi Date: Wed, 22 Jan 2025 20:30:29 +0200 Subject: [PATCH 5/9] temporary disable SHA1 signature inhibitor --- .../el8toel9/actors/checkdeprecatedrpmsignature/actor.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/repos/system_upgrade/el8toel9/actors/checkdeprecatedrpmsignature/actor.py b/repos/system_upgrade/el8toel9/actors/checkdeprecatedrpmsignature/actor.py index 549b4c7d63..3c79004c14 100644 --- a/repos/system_upgrade/el8toel9/actors/checkdeprecatedrpmsignature/actor.py +++ b/repos/system_upgrade/el8toel9/actors/checkdeprecatedrpmsignature/actor.py @@ -37,4 +37,6 @@ class CheckDeprecatedRPMSignature(Actor): tags = (IPUWorkflowTag, ChecksPhaseTag) def process(self): - checkdeprecatedrpmsignature.process() + # todo: resign all packages and turn the check back on + # checkdeprecatedrpmsignature.process() + pass From 1e718b20beb4610958b52ec94911a65e53a7d37f Mon Sep 17 00:00:00 2001 From: Oleksandr Shyshatskyi Date: Fri, 24 Jan 2025 10:46:44 +0200 Subject: [PATCH 6/9] temporary disable actors that are not compatible with cl9 --- .../cloudlinux/actors/checkrhnclienttools/actor.py | 3 +++ .../cloudlinux/actors/clearpackageconflicts/actor.py | 3 ++- .../el8toel9/actors/checkdeprecatedrpmsignature/actor.py | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/repos/system_upgrade/cloudlinux/actors/checkrhnclienttools/actor.py b/repos/system_upgrade/cloudlinux/actors/checkrhnclienttools/actor.py index 596f3c6d22..a36712ba45 100644 --- a/repos/system_upgrade/cloudlinux/actors/checkrhnclienttools/actor.py +++ b/repos/system_upgrade/cloudlinux/actors/checkrhnclienttools/actor.py @@ -27,6 +27,9 @@ class CheckRhnClientToolsVersion(Actor): @run_on_cloudlinux def process(self): + # todo: (CLOS-3202) update the actor + return + title, summary, remediation = None, None, None # ex: # Version : 2.0.2 diff --git a/repos/system_upgrade/cloudlinux/actors/clearpackageconflicts/actor.py b/repos/system_upgrade/cloudlinux/actors/clearpackageconflicts/actor.py index 5c70a62307..fc642d5029 100644 --- a/repos/system_upgrade/cloudlinux/actors/clearpackageconflicts/actor.py +++ b/repos/system_upgrade/cloudlinux/actors/clearpackageconflicts/actor.py @@ -97,5 +97,6 @@ def lua_cjson_handle(self): @run_on_cloudlinux def process(self): - self.rpm_lookup = {rpm for rpm in self.consume(InstalledRPM)} + # todo: (CLOS-3205) investigate why set is needed here + self.rpm_lookup = [rpm for rpm in self.consume(InstalledRPM)] self.alt_python37_handle() diff --git a/repos/system_upgrade/el8toel9/actors/checkdeprecatedrpmsignature/actor.py b/repos/system_upgrade/el8toel9/actors/checkdeprecatedrpmsignature/actor.py index 3c79004c14..bbf2981740 100644 --- a/repos/system_upgrade/el8toel9/actors/checkdeprecatedrpmsignature/actor.py +++ b/repos/system_upgrade/el8toel9/actors/checkdeprecatedrpmsignature/actor.py @@ -37,6 +37,6 @@ class CheckDeprecatedRPMSignature(Actor): tags = (IPUWorkflowTag, ChecksPhaseTag) def process(self): - # todo: resign all packages and turn the check back on + # todo: (CLOS-3206) resign all packages and turn the check back on # checkdeprecatedrpmsignature.process() pass From 6514dce49945ba90fe7660eb5539505db390a020 Mon Sep 17 00:00:00 2001 From: Oleksandr Shyshatskyi Date: Fri, 24 Jan 2025 10:47:02 +0200 Subject: [PATCH 7/9] switch cln channel version according to target os version --- .../cloudlinux/actors/switchclnchanneldownload/actor.py | 3 ++- .../cloudlinux/actors/switchclnchannelreset/actor.py | 5 +++-- .../actors/targetuserspacecreator/libraries/userspacegen.py | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/repos/system_upgrade/cloudlinux/actors/switchclnchanneldownload/actor.py b/repos/system_upgrade/cloudlinux/actors/switchclnchanneldownload/actor.py index 7293991145..bc1c9f5075 100644 --- a/repos/system_upgrade/cloudlinux/actors/switchclnchanneldownload/actor.py +++ b/repos/system_upgrade/cloudlinux/actors/switchclnchanneldownload/actor.py @@ -9,6 +9,7 @@ from leapp.libraries.common.cln_switch import cln_switch, get_target_userspace_path from leapp import reporting from leapp.reporting import Report +from leapp.libraries.common.config.version import get_target_major_version @@ -29,7 +30,7 @@ class SwitchClnChannelDownload(Actor): @run_on_cloudlinux def process(self): try: - cln_switch(target=8) + cln_switch(target=int(get_target_major_version())) except CalledProcessError as e: reporting.create_report( [ diff --git a/repos/system_upgrade/cloudlinux/actors/switchclnchannelreset/actor.py b/repos/system_upgrade/cloudlinux/actors/switchclnchannelreset/actor.py index 74090f7d53..637cefb571 100644 --- a/repos/system_upgrade/cloudlinux/actors/switchclnchannelreset/actor.py +++ b/repos/system_upgrade/cloudlinux/actors/switchclnchannelreset/actor.py @@ -4,6 +4,7 @@ from leapp.libraries.stdlib import CalledProcessError from leapp.libraries.common.cllaunch import run_on_cloudlinux from leapp.libraries.common.cln_switch import cln_switch +from leapp.libraries.common.config.version import get_source_major_version from leapp import reporting from leapp.reporting import Report @@ -21,12 +22,12 @@ class SwitchClnChannelReset(Actor): @run_on_cloudlinux def process(self): try: - cln_switch(target=7) + cln_switch(target=get_source_major_version()) except CalledProcessError as e: reporting.create_report( [ reporting.Title( - "Failed to switch CloudLinux Network channel from to 7." + "Failed to switch CloudLinux Network channel." ), reporting.Summary( "Command {} failed with exit code {}." diff --git a/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py b/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py index 5be29e67ad..29dc6b2c44 100644 --- a/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py +++ b/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py @@ -340,7 +340,7 @@ def prepare_target_userspace(context, userspace_dir, enabled_repos, packages): # transaction check phase is done - so the preupgrade checks won't affect the host system. # The 'switch_cln_channel_download' actor should take care of switching the channel back to the CL8 channel # when it's time to download the upgrade packages. - cln_switch(target=8) + cln_switch(target=int(get_target_major_version())) def _query_rpm_for_pkg_files(context, pkgs): From 7c600dfb1130505318ff5158984d14a1c325b5ba Mon Sep 17 00:00:00 2001 From: Oleksandr Shyshatskyi Date: Fri, 24 Jan 2025 12:13:25 +0200 Subject: [PATCH 8/9] Remove link to el7toel8 repository Linking a repository is needed, when the current repository requires things like Tags, Models, Topics, Workflows etc from another repository which does not seem to be the case in our situation. With this link leapp always expects el7toel8 to be available which is not the case for cloudlinux 8. --- repos/system_upgrade/cloudlinux/.leapp/info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repos/system_upgrade/cloudlinux/.leapp/info b/repos/system_upgrade/cloudlinux/.leapp/info index 1f16b9fae1..07be6e6e18 100644 --- a/repos/system_upgrade/cloudlinux/.leapp/info +++ b/repos/system_upgrade/cloudlinux/.leapp/info @@ -1 +1 @@ -{"name": "cloudlinux", "id": "427ddd90-9b5e-4400-b21e-73d77791f175", "repos": ["644900a5-c347-43a3-bfab-f448f46d9647", "c47fbc3d-ae38-416e-9176-7163d67d94f6", "efcf9016-f2d1-4609-9329-a298e6587b3c"]} \ No newline at end of file +{"name": "cloudlinux", "id": "427ddd90-9b5e-4400-b21e-73d77791f175", "repos": ["644900a5-c347-43a3-bfab-f448f46d9647", "efcf9016-f2d1-4609-9329-a298e6587b3c"]} \ No newline at end of file From c282401fefc242c546da0324860ec67b18977dab Mon Sep 17 00:00:00 2001 From: Oleksandr Shyshatskyi Date: Tue, 28 Jan 2025 14:03:32 +0200 Subject: [PATCH 9/9] fix review comments --- .../targetuserspacecreator/libraries/userspacegen.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py b/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py index 29dc6b2c44..dce6735389 100644 --- a/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py +++ b/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py @@ -262,9 +262,10 @@ def prepare_target_userspace(context, userspace_dir, enabled_repos, packages): api.current_logger().debug('Installing cloudlinux-release') context.call(['rpm', '--import', 'https://repo.cloudlinux.com/cloudlinux/security/RPM-GPG-KEY-CloudLinux'], callback_raw=utils.logging_handler) - cloudlinux_release_url = 'https://repo.cloudlinux.com/cloudlinux/migrate/release-files' \ - '/cloudlinux/{version}/x86_64/cloudlinux{version}-release-current.x86_64.rpm' \ - ''.format(version=target_major_version) + cloudlinux_release_url = ( + 'https://repo.cloudlinux.com/cloudlinux/migrate/release-files' + '/cloudlinux/{version}/x86_64/cloudlinux{version}-release-current.x86_64.rpm' + ).format(version=target_major_version) context.call(['dnf', '-y', 'localinstall', cloudlinux_release_url], callback_raw=utils.logging_handler) @@ -340,7 +341,7 @@ def prepare_target_userspace(context, userspace_dir, enabled_repos, packages): # transaction check phase is done - so the preupgrade checks won't affect the host system. # The 'switch_cln_channel_download' actor should take care of switching the channel back to the CL8 channel # when it's time to download the upgrade packages. - cln_switch(target=int(get_target_major_version())) + cln_switch(target=int(target_major_version)) def _query_rpm_for_pkg_files(context, pkgs):