Skip to content

Commit

Permalink
libraries: dnfplugin: Apply the yum workaround on RHEL 7 only
Browse files Browse the repository at this point in the history
Co-Authored-By: Michal Reznik (mreznik) <[email protected]>
  • Loading branch information
pirat89 and Rezney committed Jul 15, 2021
1 parent 76d67bb commit d54e633
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions repos/system_upgrade/common/libraries/dnfplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from leapp.exceptions import StopActorExecutionError
from leapp.libraries.common import guards, mounting, overlaygen, rhsm, utils
from leapp.libraries.common.config.version import get_target_major_version
from leapp.libraries.common.config.version import get_target_major_version, get_source_major_version
from leapp.libraries.stdlib import CalledProcessError, api, config


Expand Down Expand Up @@ -196,6 +196,14 @@ def _prepare_transaction(used_repos, target_userspace_info, binds=()):
yield context, list(target_repoids), target_userspace_info


def _apply_yum_workaround(context):
"""
Apply the yum workaround in the given context environment if on RHEL 7.
"""
if get_source_major_version() == '7':
utils.apply_yum_workaround(context)


def install_initramdisk_requirements(packages, target_userspace_info, used_repos):
"""
Performs the installation of packages into the initram disk
Expand Down Expand Up @@ -271,7 +279,7 @@ def perform_transaction_check(target_userspace_info, used_repos, tasks, xfs_info
with overlaygen.create_source_overlay(mounts_dir=userspace_info.mounts, scratch_dir=userspace_info.scratch,
xfs_info=xfs_info, storage_info=storage_info,
mount_target=os.path.join(context.base_dir, 'installroot')) as overlay:
utils.apply_yum_workaround(overlay.nspawn())
_apply_yum_workaround(overlay.nspawn())
_transaction(
context=context, stage='check', target_repoids=target_repoids, plugin_info=plugin_info, tasks=tasks
)
Expand All @@ -287,7 +295,7 @@ def perform_rpm_download(target_userspace_info, used_repos, tasks, xfs_info, sto
with overlaygen.create_source_overlay(mounts_dir=userspace_info.mounts, scratch_dir=userspace_info.scratch,
xfs_info=xfs_info, storage_info=storage_info,
mount_target=os.path.join(context.base_dir, 'installroot')) as overlay:
utils.apply_yum_workaround(overlay.nspawn())
_apply_yum_workaround(overlay.nspawn())
_transaction(
context=context, stage='download', target_repoids=target_repoids, plugin_info=plugin_info, tasks=tasks,
test=True, on_aws=on_aws
Expand Down

0 comments on commit d54e633

Please sign in to comment.