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

Avoid installation problem #326

Merged
merged 3 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
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
61 changes: 0 additions & 61 deletions centos2almaconverter/actions/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,64 +79,3 @@ def _post_action(self) -> action.ActionResult:

def _revert_action(self) -> action.ActionResult:
return action.ActionResult()


class PatchLeappErrorOutput(action.ActiveAction):

def __init__(self):
self.name = "patch leapp error log output"
self.path_to_src = "/usr/share/leapp-repository/repositories/system_upgrade/common/libraries/dnfplugin.py"

def _prepare_action(self) -> action.ActionResult:
# Looks like there is no setter for stdout/stderr in the python for leapp
files.replace_string(self.path_to_src, "if six.PY2:", "if False:")
return action.ActionResult()

def _post_action(self) -> action.ActionResult:
return action.ActionResult()

def _revert_action(self) -> action.ActionResult:
return action.ActionResult()


class PatchLeappDebugNonAsciiPackager(action.ActiveAction):

def __init__(self):
self.name = "patch leapp to allow print debug message for non-ascii packager"
self.path_to_src = "/usr/share/leapp-repository/repositories/system_upgrade/common/actors/redhatsignedrpmscanner/actor.py"

def is_required(self) -> bool:
return os.path.exists(self.path_to_src)

def _prepare_action(self) -> action.ActionResult:
# so sometimes we could have non-ascii packager name, in this case leapp will fail
# on printing debug message. So we need to encode it to utf-8 before print (and only before print I think)
files.replace_string(self.path_to_src, ", pkg.packager", ", pkg.packager.encode('utf-8')")
return action.ActionResult()

def _post_action(self) -> action.ActionResult:
return action.ActionResult()

def _revert_action(self) -> action.ActionResult:
return action.ActionResult()


class PatchLeappHandleDnfpluginErrorAscii(action.ActiveAction):
path_to_src: str

def __init__(self):
self.name = "patch leapp to handle dnf plugin error for ascii packager"
self.path_to_src = "/usr/share/leapp-repository/repositories/system_upgrade/common/libraries/dnfplugin.py"

def is_required(self) -> bool:
return os.path.exists(self.path_to_src)

def _prepare_action(self) -> action.ActionResult:
files.replace_string(self.path_to_src, "if False", "if True")
return action.ActionResult()

def _post_action(self) -> action.ActionResult:
return action.ActionResult()

def _revert_action(self) -> action.ActionResult:
return action.ActionResult()
14 changes: 11 additions & 3 deletions centos2almaconverter/actions/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,17 @@ def _prepare_action(self) -> action.ActionResult:

leapp_configs.add_repositories_mapping(repofiles)

# For some reason leapp replaces the libssh2 package on installation. It's fine in most cases,
# but imunify packages require libssh2. So we should use PRESENT action to keep it.
leapp_configs.set_package_action("libssh2", leapp_configs.LeappActionType.PRESENT)
# libssh2 and libunwind are needed for imunify360, so we must configure actions for them.
# We need to map the packages to the ones available in the AlmaLinux 8 EPEL repository.
# Additionally, we must remove the actions for libssh2 from the sl repo and
# libunwind from the appstream repo. For some reason, leapp checks all actions
# and becomes confused by these actions.
leapp_configs.set_package_mapping("libssh2", "base", "libssh2", "el8-epel")
leapp_configs.remove_package_action("libssh2", "sl")

leapp_configs.set_package_action("libunwind", leapp_configs.LeappActionType.REPLACED)
leapp_configs.set_package_mapping("libunwind", "base", "libunwind", "el8-epel")
leapp_configs.remove_package_action("libunwind", "almalinux8-appstream")
return action.ActionResult()

def _post_action(self) -> action.ActionResult:
Expand Down
6 changes: 3 additions & 3 deletions centos2almaconverter/actions/installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ class LeapInstallation(action.ActiveAction):
def __init__(self):
self.name = "installing leapp"
self.pkgs_to_install = [
"leapp-0.14.0-1.el7",
"python2-leapp-0.14.0-1.el7",
"leapp-data-almalinux-0.1-6.el7",
"leapp-0.16.0-2.el7",
"python2-leapp-0.16.0-2.el7",
"leapp-data-almalinux-0.2-15.el7.20230823",
]

def _prepare_action(self) -> action.ActionResult:
Expand Down
3 changes: 0 additions & 3 deletions centos2almaconverter/upgrader.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,6 @@ def construct_actions(
centos2alma_actions.AdoptKolabRepositories(),
centos2alma_actions.AdoptAtomicRepositories(),
centos2alma_actions.FixupImunify(),
centos2alma_actions.PatchLeappErrorOutput(),
centos2alma_actions.PatchLeappDebugNonAsciiPackager(),
centos2alma_actions.PatchLeappHandleDnfpluginErrorAscii(),
common_actions.AddUpgradeSystemdService(os.path.abspath(sys.argv[0]), options),
common_actions.UpdatePlesk(),
centos2alma_actions.PostgresReinstallModernPackage(),
Expand Down
Loading