From 034fa5e7ef2818d789f32079be972440ef8118c7 Mon Sep 17 00:00:00 2001 From: Nikolay Vizovitin <73231049+vizovitin@users.noreply.github.com> Date: Tue, 8 Oct 2024 12:24:55 +0300 Subject: [PATCH] Simulate MariaDB upgrade before removing packages. --- cloudlinux7to8/actions/mariadb.py | 11 ++++++++--- dist-upgrader | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cloudlinux7to8/actions/mariadb.py b/cloudlinux7to8/actions/mariadb.py index b31e9fc..9aaada7 100644 --- a/cloudlinux7to8/actions/mariadb.py +++ b/cloudlinux7to8/actions/mariadb.py @@ -109,8 +109,10 @@ def _post_action(self) -> action.ActionResult: mariadb_repo_id, _1, _2, _3, _4, _5 = [repo for repo in rpm.extract_repodata(repofiles[0])][0] + packages = ["MariaDB-client", "MariaDB-server"] + rpm.install_packages(packages, repository=mariadb_repo_id, simulate=True) _remove_mariadb_packages() - rpm.install_packages(["MariaDB-client", "MariaDB-server"], repository=mariadb_repo_id) + rpm.install_packages(packages, repository=mariadb_repo_id) return action.ActionResult() def _revert_action(self) -> action.ActionResult: @@ -142,8 +144,10 @@ def _post_action(self) -> action.ActionResult: files.backup_file(repofile) os.unlink(repofile) + packages = ["mariadb", "mariadb-server"] + rpm.install_packages(packages, simulate=True) _remove_mariadb_packages() - rpm.install_packages(["mariadb", "mariadb-server"]) + rpm.install_packages(packages) # We should be sure mariadb is started, otherwise restore wouldn't work util.logged_check_call(["/usr/bin/systemctl", "start", "mariadb"]) @@ -254,8 +258,9 @@ def _post_action(self) -> action.ActionResult: mariadb_module = f"mariadb:cl-MariaDB{mariadb_version.major}{mariadb_version.minor}" log.debug(f"Going to reinstall following packages with enabled dnf module {mariadb_module!r}: {mariadb_packages}") - rpm.remove_packages(rpm.filter_installed_packages(mariadb_packages)) util.logged_check_call(["dnf", "module", "-y", "enable", mariadb_module]) + rpm.install_packages(mariadb_packages, simulate=True) + rpm.remove_packages(rpm.filter_installed_packages(mariadb_packages)) rpm.install_packages(mariadb_packages) return action.ActionResult() diff --git a/dist-upgrader b/dist-upgrader index b2c1bbf..07df929 160000 --- a/dist-upgrader +++ b/dist-upgrader @@ -1 +1 @@ -Subproject commit b2c1bbff2da657698bd18a4a5913bb6dcc7dee1c +Subproject commit 07df929fd058ea599e2351ccf624a1bd1c0d0ef2