diff --git a/cloudlinux7to8/actions/__init__.py b/cloudlinux7to8/actions/__init__.py index bf098a9..9e12459 100644 --- a/cloudlinux7to8/actions/__init__.py +++ b/cloudlinux7to8/actions/__init__.py @@ -4,7 +4,6 @@ from .configure import * from .convert import * from .extensions import * -from .installation import * from .mariadb import * from .packages import * from .perl import * diff --git a/cloudlinux7to8/actions/installation.py b/cloudlinux7to8/actions/installation.py deleted file mode 100644 index 8288eae..0000000 --- a/cloudlinux7to8/actions/installation.py +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright 1999 - 2026. WebPros International GmbH. All rights reserved. -import os -import shutil -import typing - -from pleskdistup.common import action, rpm, util - -LEAPP_CLOUDLINUX_RPM_URL = "https://repo.cloudlinux.com/elevate/elevate-release-latest-el7.noarch.rpm" - - -class LeappInstallation(action.ActiveAction): - pkgs_to_install: typing.List[str] - elevate_release_rpm_url: str - remove_logs_on_finish: bool - - def __init__(self, elevate_release_rpm_url: str, pkgs_to_install: typing.List[str], remove_logs_on_finish: bool = False): - self.name = "installing leapp" - self.pkgs_to_install = pkgs_to_install - self.elevate_release_rpm_url = elevate_release_rpm_url - self.remove_logs_on_finish = remove_logs_on_finish - - def _prepare_action(self) -> action.ActionResult: - if not rpm.is_package_installed("elevate-release"): - util.logged_check_call(["/usr/bin/yum", "install", "-y", self.elevate_release_rpm_url]) - - util.logged_check_call(["/usr/bin/yum-config-manager", "--enable", "cloudlinux-elevate"]) - - util.logged_check_call(["/usr/bin/yum", "install", "-y"] + self.pkgs_to_install) - # We want to prevent the leapp packages from being updated accidentally to - # the latest version (for example by using 'yum update -y'). Therefore, we - # should disable the 'cloudlinux-elevate' repository. Additionally, this will prevent - # the pre-checker from detecting leapp as outdated and prevent re-evaluation - # on the next restart. - util.logged_check_call(["/usr/bin/yum-config-manager", "--disable", "cloudlinux-elevate"]) - return action.ActionResult() - - def remove_all(self, include_logs: bool = True) -> None: - rpm.remove_packages( - rpm.filter_installed_packages( - self.pkgs_to_install + ["elevate-release", "leapp-upgrade-el7toel8"] - ) - ) - - leapp_related_files = [ - "/root/tmp_leapp_py3/leapp", - ] - for file in leapp_related_files: - if os.path.exists(file): - os.unlink(file) - - leapp_related_directories = [ - "/etc/leapp", - "/var/lib/leapp", - "/usr/lib/python2.7/site-packages/leapp", - ] - if include_logs: - leapp_related_directories.append("/var/log/leapp") - for directory in leapp_related_directories: - if os.path.exists(directory): - shutil.rmtree(directory) - - def _post_action(self) -> action.ActionResult: - self.remove_all(include_logs=self.remove_logs_on_finish) - return action.ActionResult() - - def _revert_action(self) -> action.ActionResult: - self.remove_all(include_logs=False) - return action.ActionResult() - - def estimate_prepare_time(self) -> int: - return 40 diff --git a/cloudlinux7to8/upgrader.py b/cloudlinux7to8/upgrader.py index 56ce5e1..16cc2fa 100644 --- a/cloudlinux7to8/upgrader.py +++ b/cloudlinux7to8/upgrader.py @@ -20,6 +20,8 @@ class CloudLinux7to8Upgrader(DistUpgrader): _pre_reboot_delay = 45 + _leapp_cloudlinux_rpm_url: str = "https://repo.cloudlinux.com/elevate/elevate-release-latest-el7.noarch.rpm" + def __init__(self): super().__init__() @@ -113,8 +115,8 @@ def construct_actions( common_actions.AddInProgressSshLoginMessage(new_os), ], "Leapp installation": [ - custom_actions.LeappInstallation( - custom_actions.LEAPP_CLOUDLINUX_RPM_URL, + common_actions.LeappInstallation( + self._leapp_cloudlinux_rpm_url, [ "leapp-0.18.0-2.el7", "python2-leapp-0.18.0-2.el7", @@ -123,6 +125,7 @@ def construct_actions( "leapp-upgrade-el7toel8-0.20.0-7.el7", "leapp-upgrade-el7toel8-deps-0.20.0-7.el7", ], + elevate_repo_id="cloudlinux-elevate", remove_logs_on_finish=self.remove_leapp_logs ), ], diff --git a/dist-upgrader b/dist-upgrader index dbfc17e..7bf6120 160000 --- a/dist-upgrader +++ b/dist-upgrader @@ -1 +1 @@ -Subproject commit dbfc17e4661f21c77d68d2828b3c1d4c6294faec +Subproject commit 7bf6120eed07a56037293980e36700a20f7ec750