Exemple #1
0
def setup_products_for_upgrade(product, os_version):
    """Sets up product(s) to perform upgrade on

    :param string product: The product name to setup before upgrade
    :param string os_version: The os version on which product is installed
        e.g: rhel6, rhel7
    """
    if check_necessary_env_variables_for_upgrade(product):
        sat_host = cap_hosts = clients6 = clients7 = None
        logger.info('Setting up Satellite ....')
        sat_host = satellite6_setup(os_version)
        if product == 'capsule' or product == 'n-1' or product == 'longrun':
            logger.info('Setting up Capsule ....')
            cap_hosts = satellite6_capsule_setup(
                sat_host, os_version, False if product == 'n-1' else True)
        if product == 'client' or product == 'longrun':
            logger.info('Setting up Clients ....')
            clients6, clients7 = satellite6_client_setup()
        setups_dict = {
            'sat_host': sat_host,
            'capsule_hosts': cap_hosts,
            'clients6': clients6,
            'clients7': clients7
        }
        create_setup_dict(setups_dict)
        if os.environ.get('RUN_EXISTANCE_TESTS', 'false').lower() == 'true':
            logger.info('Setting up preupgrade datastore for existance tests')
            set_datastore('preupgrade')
        return sat_host, cap_hosts, clients6, clients7
Exemple #2
0
def setup_products_for_upgrade(product, os_version):
    """Sets up product(s) to perform upgrade on

    :param string product: The product name to setup before upgrade
    :param string os_version: The os version on which product is installed
        e.g: rhel6, rhel7
    """
    if check_necessary_env_variables_for_upgrade(product):
        sat_host = cap_hosts = clients6 = clients7 = None
        logger.info('Setting up Satellite ....')
        sat_host = satellite6_setup(os_version)
        if product == 'capsule' or product == 'n-1' or product == 'longrun':
            logger.info('Setting up Capsule ....')
            cap_hosts = satellite6_capsule_setup(
                sat_host, os_version, False if product == 'n-1' else True)
        if product == 'client' or product == 'longrun':
            logger.info('Setting up Clients ....')
            clients6, clients7, puppet_clients7 = satellite6_client_setup()
        setups_dict = {
            'sat_host': sat_host,
            'capsule_hosts': cap_hosts,
            'clients6': clients6,
            'clients7': clients7,
            'puppet_clients7': puppet_clients7
        }
        create_setup_dict(setups_dict)
        return sat_host, cap_hosts, clients6, clients7, puppet_clients7
def product_setup_for_upgrade_on_brokers_machine(product,
                                                 os_version,
                                                 satellite,
                                                 capsule=None):
    """
    Sets up product(s) to perform upgrade on Satellite, Capsule and content host
    :param string product: The product name to setup before upgrade
    :param string os_version: The os version on which product is installed e.g: rhel6, rhel7
    :param satellite: brokers/users provided satellite
    :param capsule: brokers/users provided capsules, if the capsules count more than one then
     we keep them separate by a semicolon examplet: test1.xyz.com;test2.xyz.com
    """
    cap_hosts = None
    clients6 = clients7 = puppet_clients7 = puppet_clients6 = None
    env.disable_known_hosts = True
    check_necessary_env_variables_for_upgrade(product)

    clients6 = clients7 = puppet_clients7 = puppet_clients6 = None
    logger.info('Setting up Satellite ....')
    satellite_setup(satellite)
    if product in ['capsule', 'n-1', 'longrun']:
        cap_hosts = capsule.split()
        if len(cap_hosts) > 0:
            logger.info('Setting up Capsule ....')
            satellite_capsule_setup(satellite, cap_hosts, os_version,
                                    False if product == 'n-1' else True)
        else:
            logger.highlight(
                f'No capsule is available for capsule setup from provided'
                f' capsules: {cap_hosts}. Aborting...')
            sys.exit(1)
    if product in ['client', 'longrun']:
        logger.info('Setting up Clients ....')
        clients6, clients7, puppet_clients7, puppet_clients6 = satellite6_client_setup(
        )

    setups_dict = {
        satellite: {
            'sat_host': satellite,
            'capsule_hosts': cap_hosts,
            'clients6': clients6,
            'clients7': clients7,
            'puppet_clients7': puppet_clients7,
            'puppet_clients6': puppet_clients6
        }
    }
    create_setup_dict(setups_dict)