Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove old leapp packages before installation to make sure we user right version of packages #338

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions centos2almaconverter/actions/installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,24 @@ def __init__(self):
"leapp-data-almalinux-0.2-15.el7.20230823",
]

def _remove_previous_installation(self) -> None:
# Remove previously installed leapp packages to make sure we will install the correct version
pkgs_to_remove = rpm.filter_installed_packages(["leapp", "python2-leapp", "leapp-data-almalinux"])
if pkgs_to_remove:
util.logged_check_call(["/usr/bin/yum", "remove", "-y"] + pkgs_to_remove)

# The directory contains leapp-data package configurations, which causes problems with
# the package installation. So we have to remove it, to reinstall package from scratch.
conflict_directory = "/etc/leapp/repos.d/system_upgrade"
if os.path.exists(conflict_directory):
shutil.rmtree(conflict_directory)

def _prepare_action(self) -> action.ActionResult:
if not rpm.is_package_installed("elevate-release"):
util.logged_check_call(["/usr/bin/yum", "install", "-y", "https://repo.almalinux.org/elevate/elevate-release-latest-el7.noarch.rpm"])

self._remove_previous_installation()

util.logged_check_call(["/usr/bin/yum-config-manager", "--enable", "elevate"])

util.logged_check_call(["/usr/bin/yum", "install", "-y"] + self.pkgs_to_install)
Expand Down
Loading