Esempio n. 1
0
def perform_rpm_download(target_userspace_info,
                         used_repos,
                         tasks,
                         xfs_info,
                         storage_info,
                         plugin_info,
                         on_aws=False):
    """
    Perform RPM download including the transaction test using dnf with our plugin
    """
    with _prepare_transaction(
            used_repos=used_repos,
            target_userspace_info=target_userspace_info) as (context,
                                                             target_repoids,
                                                             userspace_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())
            _transaction(context=context,
                         stage='download',
                         target_repoids=target_repoids,
                         plugin_info=plugin_info,
                         tasks=tasks,
                         test=True,
                         on_aws=on_aws)
Esempio n. 2
0
def test_prepare_yum_config(monkeypatch, adjust_cwd):
    actions = MockedNotIsolatedActions()
    monkeypatch.setattr(api, "get_tool_path", _get_tool_path)
    monkeypatch.setattr(mounting, "NotIsolatedActions", actions)
    apply_yum_workaround()
    assert actions.called == 1
    assert os.path.basename(actions.args[-1]) == 'handleyumconfig'
Esempio n. 3
0
def test_prepare_yum_config(monkeypatch):
    run = run_mocked()
    with monkeypatch.context() as context:
        context.setattr(leapp.libraries.stdlib, 'run', run)
        context.setattr(leapp.libraries.stdlib.api, 'get_tool_path',
                        _get_tool_path)
        from leapp.libraries.common import utils  # Needed locally to allow monkey patching to actually work
        utils.apply_yum_workaround()
    assert run.called == 1
    assert os.path.basename(run.args[-1]) == 'handleyumconfig'
Esempio n. 4
0
def perform_transaction_check(target_userspace_info, used_repos, tasks, xfs_info, storage_info, plugin_info):
    """
    Perform DNF transaction check using our plugin
    """
    with _prepare_transaction(used_repos=used_repos,
                              target_userspace_info=target_userspace_info
                              ) as (context, target_repoids, userspace_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())
            _transaction(
                context=context, stage='check', target_repoids=target_repoids, plugin_info=plugin_info, tasks=tasks
            )
Esempio n. 5
0
def perform_rpm_download(target_userspace_info, used_repos, tasks,
                         xfs_present):
    """
    Perform RPM download including the transaction test using dnf with our plugin
    """
    with _prepare_transaction(
            used_repos=used_repos,
            target_userspace_info=target_userspace_info) as (context,
                                                             target_repoids,
                                                             userspace_info):
        with overlaygen.create_source_overlay(
                mounts_dir=userspace_info.mounts,
                scratch_dir=userspace_info.scratch,
                xfs_present=xfs_present) as overlay:
            utils.apply_yum_workaround(overlay.nspawn())
            with mounting.BindMount(source=overlay.target,
                                    target=os.path.join(
                                        context.base_dir, 'installroot')):
                _transaction(context=context,
                             stage='download',
                             target_repoids=target_repoids,
                             tasks=tasks,
                             test=True)
Esempio n. 6
0
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)
Esempio n. 7
0
 def process(self):
     utils.apply_yum_workaround()