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: _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)
def perform(): # NOTE: this one action is out of unit-tests completely; we do not use # in unit tests the LEAPP_DEVEL_SKIP_RHSM envar anymore _check_deprecated_rhsm_skip() indata = _InputData() prod_cert_path = _get_product_certificate_path() with overlaygen.create_source_overlay(mounts_dir=constants.MOUNTS_DIR, scratch_dir=constants.SCRATCH_DIR, storage_info=indata.storage_info, xfs_info=indata.xfs_info) as overlay: with overlay.nspawn() as context: target_repoids = _gather_target_repositories( context, indata, prod_cert_path) _create_target_userspace(context, indata.packages, indata.files, target_repoids) # TODO: this is tmp solution as proper one needs significant refactoring target_repo_facts = repofileutils.get_parsed_repofiles(context) api.produce( TMPTargetRepositoriesFacts(repositories=target_repo_facts)) # ## TODO ends here api.produce( UsedTargetRepositories(repos=[ UsedTargetRepository(repoid=repo) for repo in target_repoids ])) api.produce( TargetUserSpaceInfo(path=_get_target_userspace(), scratch=constants.SCRATCH_DIR, mounts=constants.MOUNTS_DIR))
def _prepare_perform(used_repos, target_userspace_info, xfs_info, storage_info): 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: yield context, overlay, target_repoids
def perform(): packages = {'dnf'} for message in api.consume(RequiredTargetUserspacePackages): packages.update(message.packages) rhsm_info = next(api.consume(SourceRHSMInfo), None) if not rhsm_info and not rhsm.skip_rhsm(): api.current_logger().warn( 'Could not receive RHSM information - Is this system registered?') return xfs_info = next(api.consume(XFSPresence), XFSPresence()) storage_info = next(api.consume(StorageInfo), None) if not storage_info: api.current_logger.error('No storage info available cannot proceed.') prod_cert_path = _get_product_certificate_path() with overlaygen.create_source_overlay(mounts_dir=constants.MOUNTS_DIR, scratch_dir=constants.SCRATCH_DIR, storage_info=storage_info, xfs_info=xfs_info) as overlay: with overlay.nspawn() as context: target_version = api.current_actor().configuration.version.target with rhsm.switched_certificate(context, rhsm_info, prod_cert_path, target_version) as target_rhsm_info: api.current_logger().debug( 'Target RHSM Info: SKUs: {skus} Repositories: {repos}'. format(repos=target_rhsm_info.enabled_repos, skus=rhsm_info.attached_skus if rhsm_info else [])) target_repoids = gather_target_repositories(target_rhsm_info) api.current_logger().debug( "Gathered target repositories: {}".format( ', '.join(target_repoids))) if not target_repoids: raise StopActorExecutionError( message= 'There are no enabled target repositories for the upgrade process to proceed.', details={ 'hint': ('Ensure your system is correctly registered with the subscription manager and that' ' your current subscription is entitled to install the requested target version {version}' ).format(version=api.current_actor(). configuration.version.target) }) prepare_target_userspace(context, constants.TARGET_USERSPACE, target_repoids, list(packages)) _prep_repository_access(context, constants.TARGET_USERSPACE) dnfplugin.install(constants.TARGET_USERSPACE) api.produce( UsedTargetRepositories(repos=[ UsedTargetRepository(repoid=repo) for repo in target_repoids ])) api.produce(target_rhsm_info) api.produce( TargetUserSpaceInfo(path=constants.TARGET_USERSPACE, scratch=constants.SCRATCH_DIR, mounts=constants.MOUNTS_DIR))
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: _apply_yum_workaround(overlay.nspawn()) _transaction( context=context, stage='check', target_repoids=target_repoids, plugin_info=plugin_info, tasks=tasks )
def perform(): packages, rhsm_info, xfs_info, storage_info = _consume_data() prod_cert_path = _get_product_certificate_path() with overlaygen.create_source_overlay(mounts_dir=constants.MOUNTS_DIR, scratch_dir=constants.SCRATCH_DIR, storage_info=storage_info, xfs_info=xfs_info) as overlay: with overlay.nspawn() as context: target_repoids = _gather_target_repositories( context, rhsm_info, prod_cert_path) _create_target_userspace(context, packages, target_repoids) api.produce( UsedTargetRepositories(repos=[ UsedTargetRepository(repoid=repo) for repo in target_repoids ])) api.produce( TargetUserSpaceInfo(path=constants.TARGET_USERSPACE, scratch=constants.SCRATCH_DIR, mounts=constants.MOUNTS_DIR))
def perform_transaction_check(target_userspace_info, used_repos, tasks, xfs_present): """ 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_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='check', target_repoids=target_repoids, tasks=tasks)
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)