コード例 #1
0
def register_appliances(appliance_set, appliances_to_register):
    with appliance_set.primary.browser_session():
        red_hat_updates.register_appliances(*appliances_to_register)

        logger.info('Waiting for appliance statuses to change to Registered')
        wait_for(red_hat_updates.are_registered,
                 func_args=appliances_to_register,
                 num_sec=120,
                 delay=REFRESH_SEC,
                 fail_func=red_hat_updates.refresh)
        logger.info('Done')

        logger.info('Waiting for implicit update check after registration')
        # The update check doesnt have to find any available updates, but it still has to run
        wait_for(red_hat_updates.checked_updates,
                 func_args=appliances_to_register,
                 num_sec=300,
                 delay=REFRESH_SEC,
                 fail_func=red_hat_updates.refresh)
        logger.info('Done')

        # And all registered appliances should be registered and subscribed
        assert red_hat_updates.are_registered(appliances_to_register),\
            'Failed to register all specified appliances'
        assert red_hat_updates.are_subscribed(appliances_to_register),\
            'Failed to subscribe all specified appliances'
コード例 #2
0
def rhn_mirror_setup(appliance_set):
    """Sets up RHN mirror feature on primary appliance and checks secondary are subscribed
    """

    appliance_set.primary.browser_steal = True
    with appliance_set.primary():
        set_server_roles(rhn_mirror=True)

    appliance_set.primary.restart_evm_service()

    with appliance_set.primary.ssh_client as ssh:

        def is_repotrack_running():
            status, output = ssh.run_command('pgrep repotrack')
            if status == 0:
                return True
            return False

        logger.info('Waiting for repotrack to start')
        wait_for(func=is_repotrack_running, delay=REFRESH_SEC, num_sec=300)
        logger.info('Done')

        logger.info('Waiting for repotrack to finish')
        wait_for(func=is_repotrack_running,
                 delay=REFRESH_SEC,
                 fail_condition=True,
                 num_sec=900)
        logger.info('Done')

        # Check that repo folder exists on primary and contains cfme-appliance pkg
        assert ssh.run_command('ls -m1 /repo/mirror | grep cfme-appliance')[0] == 0,\
            "/repo/mirror on {} doesn't exist or doesn't contain cfme-appliance pkg"\
            .format(appliance_set.primary.name)

    logger.info('Waiting for web UI to start')
    appliance_set.primary.wait_for_web_ui()
    logger.info('Done')

    # Check /etc/yum.repos.d/cfme-mirror.repo file exists on secondary appliances
    for appliance in appliance_set.secondary:
        with appliance.ssh_client as ssh:

            def repo_file_exists():
                status, output = ssh.run_command(
                    'ls /etc/yum.repos.d/cfme-mirror.repo')
                if status == 0:
                    return True
                return False

            logger.info(
                'Waiting for repository files to be created on secondary appliances'
            )
            wait_for(func=repo_file_exists, delay=REFRESH_SEC, num_sec=120)
            logger.info('Done')

    # And confirm that all appliances are subscribed
    appliance_set.primary.browser_steal = True
    with appliance_set.primary():
        assert red_hat_updates.are_subscribed(),\
            'Failed to subscribe all appliances (secondary via proxy)'
コード例 #3
0
def register_appliances(appliance_set, appliances_to_register):
    appliance_set.primary.browser_steal = True
    with appliance_set.primary():
        red_hat_updates.register_appliances(*appliances_to_register)

        logger.info('Waiting for appliance statuses to change to Registered')
        wait_for(red_hat_updates.are_registered,
                 func_args=appliances_to_register,
                 num_sec=120,
                 delay=REFRESH_SEC,
                 fail_func=red_hat_updates.refresh)
        logger.info('Done')

        logger.info('Waiting for implicit update check after registration')
        # The update check doesnt have to find any available updates, but it still has to run
        wait_for(red_hat_updates.checked_updates,
                 func_args=appliances_to_register,
                 num_sec=300,
                 delay=REFRESH_SEC,
                 fail_func=red_hat_updates.refresh)
        logger.info('Done')

        # And all registered appliances should be registered and subscribed
        assert red_hat_updates.are_registered(appliances_to_register),\
            'Failed to register all specified appliances'
        assert red_hat_updates.are_subscribed(appliances_to_register),\
            'Failed to subscribe all specified appliances'
コード例 #4
0
def rhn_mirror_setup(appliance_set):
    """Sets up RHN mirror feature on primary appliance and checks secondary are subscribed
    """

    appliance_set.primary.browser_steal = True
    with appliance_set.primary():
        set_server_roles(rhn_mirror=True)

    appliance_set.primary.restart_evm_service()

    with appliance_set.primary.ssh_client as ssh:
        def is_repotrack_running():
            status, output = ssh.run_command('pgrep repotrack')
            if status == 0:
                return True
            return False

        logger.info('Waiting for repotrack to start')
        wait_for(func=is_repotrack_running, delay=REFRESH_SEC, num_sec=300)
        logger.info('Done')

        logger.info('Waiting for repotrack to finish')
        wait_for(func=is_repotrack_running, delay=REFRESH_SEC, fail_condition=True, num_sec=900)
        logger.info('Done')

        # Check that repo folder exists on primary and contains cfme-appliance pkg
        assert ssh.run_command('ls -m1 /repo/mirror | grep cfme-appliance')[0] == 0,\
            "/repo/mirror on {} doesn't exist or doesn't contain cfme-appliance pkg"\
            .format(appliance_set.primary.name)

    logger.info('Waiting for web UI to start')
    appliance_set.primary.wait_for_web_ui()
    logger.info('Done')

    # Check /etc/yum.repos.d/cfme-mirror.repo file exists on secondary appliances
    for appliance in appliance_set.secondary:
        with appliance.ssh_client as ssh:
            def repo_file_exists():
                status, output = ssh.run_command('ls /etc/yum.repos.d/cfme-mirror.repo')
                if status == 0:
                    return True
                return False

            logger.info('Waiting for repository files to be created on secondary appliances')
            wait_for(func=repo_file_exists, delay=REFRESH_SEC, num_sec=120)
            logger.info('Done')

    # And confirm that all appliances are subscribed
    appliance_set.primary.browser_steal = True
    with appliance_set.primary():
        assert red_hat_updates.are_subscribed(),\
            'Failed to subscribe all appliances (secondary via proxy)'