예제 #1
0
def pre_ponr_conversion():
    """Perform steps and checks to guarantee system is ready for conversion."""
    loggerinst = logging.getLogger(__name__)

    # remove blacklisted packages
    loggerinst.task("Convert: Remove blacklisted packages")
    pkghandler.remove_blacklisted_pkgs()

    # checking RHN Classic
    loggerinst.task("Checking RHN Classic")
    subscription.unregister_from_rhn_classic()

    # install redhat release package
    loggerinst.task("Convert: Install Red Hat release package")
    redhatrelease.install_release_pkg()
    # replace distroverpkg variable in yum.conf
    loggerinst.task("Convert: Patch yum configuration file")
    redhatrelease.YumConf().patch()

    if systeminfo.system_info.version == "5":
        cert.copy_cert_for_rhel_5()

    # package analysis
    loggerinst.task("Convert: Package analysis")
    repos_needed = repo.package_analysis()

    if toolopts.tool_opts.disable_submgr:
        loggerinst.task("Convert: Check required repos")
        repo.check_needed_repos_availability(repos_needed)
    else:
        loggerinst.task("Convert: Subscription Manager - Install")
        subscription.install_subscription_manager()
        loggerinst.task("Convert: Subscription Manager - Subscribe system")
        subscription.subscribe_system()
        loggerinst.task("Convert: Subscription Manager - Check required repos")
        repo.check_needed_repos_availability(repos_needed)
        loggerinst.task("Convert: Subscription Manager - Disable all repos")
        subscription.disable_repos()
        loggerinst.task("Convert: Subscription Manager - Enable needed repos")
        subscription.enable_repos(repos_needed)
        # TODO: Replace renaming .repo files by using --enable for yum command
        loggerinst.task("Convert: Subscription Manager - Rename repos")
        subscription.rename_repo_files()
예제 #2
0
def pre_ponr_conversion():
    """Perform steps and checks to guarantee system is ready for conversion."""
    loggerinst = logging.getLogger(__name__)

    # remove excluded packages
    loggerinst.task("Convert: Remove excluded packages")
    pkghandler.remove_excluded_pkgs()

    # install redhat release package
    loggerinst.task("Convert: Install Red Hat release package")
    redhatrelease.install_release_pkg()
    # replace distroverpkg variable in yum.conf
    loggerinst.task("Convert: Patch yum configuration file")
    redhatrelease.YumConf().patch()

    # package analysis
    loggerinst.task("Convert: List third-party packages")
    pkghandler.list_third_party_pkgs()
    if not toolopts.tool_opts.disable_submgr:
        loggerinst.task("Convert: Subscription Manager - Install")
        subscription.install_subscription_manager()
        loggerinst.task("Convert: Subscription Manager - Subscribe system")
        subscription.subscribe_system()
        loggerinst.task("Convert: Get RHEL repository IDs")
        rhel_repoids = repo.get_rhel_repoids()
        loggerinst.task(
            "Convert: Subscription Manager - Check required repositories")
        subscription.check_needed_repos_availability(rhel_repoids)
        loggerinst.task(
            "Convert: Subscription Manager - Disable all repositories")
        subscription.disable_repos()
        loggerinst.task(
            "Convert: Subscription Manager - Enable RHEL repositories")
        subscription.enable_repos(rhel_repoids)
        # TODO: Replace renaming .repo files by using --enable for yum command
        loggerinst.task("Convert: Subscription Manager - Rename repositories")
        subscription.rename_repo_files()