def test_rh_creds_validation(request, reg_method, reg_data, proxy_url, proxy_creds):
    """ Tests whether credentials are validated correctly for RHSM and SAT6 """
    repo = reg_data.get('enable_repo')
    if not repo:
        set_default_repo = True
    else:
        set_default_repo = False

    if proxy_url:
        use_proxy = True
        proxy_username = proxy_creds['username']
        proxy_password = proxy_creds['password']
    else:
        use_proxy = False
        proxy_url = None
        proxy_username = None
        proxy_password = None
    red_hat_updates = RedHatUpdates(
        service=reg_method,
        url=reg_data['url'],
        username=conf.credentials[reg_method]['username'],
        password=conf.credentials[reg_method]['password'],
        repo_name=repo,
        organization=reg_data.get('organization'),
        use_proxy=use_proxy,
        proxy_url=proxy_url,
        proxy_username=proxy_username,
        proxy_password=proxy_password,
        set_default_repository=set_default_repo
    )
    red_hat_updates.update_registration(cancel=True)
Exemplo n.º 2
0
def test_rh_creds_validation(reg_method, reg_data, proxy_url, proxy_creds):
    """ Tests whether credentials are validated correctly for RHSM and SAT6 """
    repo = reg_data.get('enable_repo')
    if not repo:
        set_default_repo = True
    else:
        set_default_repo = False

    if proxy_url:
        use_proxy = True
        proxy_username = proxy_creds['username']
        proxy_password = proxy_creds['password']
    else:
        use_proxy = False
        proxy_url = None
        proxy_username = None
        proxy_password = None
    red_hat_updates = RedHatUpdates(
        service=reg_method,
        url=reg_data['url'],
        username=conf.credentials[reg_method]['username'],
        password=conf.credentials[reg_method]['password'],
        repo_name=repo,
        organization=reg_data.get('organization'),
        use_proxy=use_proxy,
        proxy_url=proxy_url,
        proxy_username=proxy_username,
        proxy_password=proxy_password,
        set_default_repository=set_default_repo
    )
    red_hat_updates.update_registration(cancel=True)
def test_rh_updates(appliance_preupdate, appliance):
    """ Tests whether the update button in the webui functions correctly """

    set_default_repo = True

    with appliance_preupdate:
        red_hat_updates = RedHatUpdates(
            service='rhsm',
            url=conf.cfme_data['redhat_updates']['registration']['rhsm']
            ['url'],
            username=conf.credentials['rhsm']['username'],
            password=conf.credentials['rhsm']['password'],
            set_default_repository=set_default_repo)
        red_hat_updates.update_registration(validate=False)

        red_hat_updates.check_updates()

        wait_for(func=red_hat_updates.checked_updates,
                 func_args=[appliance.server.name],
                 delay=10,
                 num_sec=100,
                 fail_func=red_hat_updates.refresh)
        if red_hat_updates.platform_updates_available():
            red_hat_updates.update_appliances()

    def is_package_updated(appliance):
        """Checks if cfme-appliance package is at version 99"""
        result = appliance.ssh_client.run_command(
            'rpm -qa cfme-appliance | grep 99')
        return result.success

    wait_for(is_package_updated, func_args=[appliance_preupdate], num_sec=900)
    result = appliance_preupdate.ssh_client.run_command(
        'rpm -qa cfme-appliance | grep 99')
    assert result.success
Exemplo n.º 4
0
def test_rh_registration(appliance, request, reg_method, reg_data, proxy_url, proxy_creds):
    """ Tests whether an appliance can be registered against RHSM and SAT6

    Polarion:
        assignee: jhenner
        caseimportance: high
        initialEstimate: 1/12h
    """
    repo = reg_data.get('enable_repo')
    if not repo:
        set_default_repo = True
    else:
        set_default_repo = False

    if proxy_url:
        use_proxy = True
        proxy_username = proxy_creds['username']
        proxy_password = proxy_creds['password']
    else:
        use_proxy = False
        proxy_url = None
        proxy_username = None
        proxy_password = None
    red_hat_updates = RedHatUpdates(
        service=reg_method,
        url=reg_data['url'],
        username=conf.credentials[reg_method]['username'],
        password=conf.credentials[reg_method]['password'],
        repo_name=repo,
        organization=reg_data.get('organization'),
        use_proxy=use_proxy,
        proxy_url=proxy_url,
        proxy_username=proxy_username,
        proxy_password=proxy_password,
        set_default_repository=set_default_repo
    )
    red_hat_updates.update_registration(validate=False if reg_method != 'sat6' else True)

    used_repo_or_channel = red_hat_updates.get_repository_names()

    # FIXME workaround BZ 1532201 (An exception to the rule as it waits for backend config)
    time.sleep(15)
    request.addfinalizer(appliance.unregister)
    red_hat_updates.register_appliances()  # Register all

    wait_for(
        func=red_hat_updates.is_registering,
        func_args=[appliance.server.name],
        delay=10,
        num_sec=240,
        fail_func=red_hat_updates.refresh
    )

    wait_for(
        func=appliance.is_registration_complete,
        func_args=[used_repo_or_channel],
        delay=20,
        num_sec=400
    )
Exemplo n.º 5
0
def test_rh_registration(appliance, request, reg_method, reg_data, proxy_url, proxy_creds):
    """ Tests whether an appliance can be registered against RHSM and SAT6

    Polarion:
        assignee: jhenner
        caseimportance: high
        casecomponent: Configuration
        initialEstimate: 1/12h
    """
    repo = reg_data.get('enable_repo')
    if not repo:
        set_default_repo = True
    else:
        set_default_repo = False

    if proxy_url:
        use_proxy = True
        proxy_username = proxy_creds['username']
        proxy_password = proxy_creds['password']
    else:
        use_proxy = False
        proxy_url = None
        proxy_username = None
        proxy_password = None
    red_hat_updates = RedHatUpdates(
        service=reg_method,
        url=reg_data['url'],
        username=conf.credentials[reg_method]['username'],
        password=conf.credentials[reg_method]['password'],
        repo_name=repo,
        organization=reg_data.get('organization'),
        use_proxy=use_proxy,
        proxy_url=proxy_url,
        proxy_username=proxy_username,
        proxy_password=proxy_password,
        set_default_repository=set_default_repo
    )
    red_hat_updates.update_registration(validate=False if reg_method != 'sat6' else True)

    used_repo_or_channel = red_hat_updates.get_repository_names()

    # FIXME workaround BZ 1532201 (An exception to the rule as it waits for backend config)
    time.sleep(15)
    request.addfinalizer(appliance.unregister)
    red_hat_updates.register_appliances()  # Register all

    wait_for(
        func=red_hat_updates.is_registering,
        func_args=[appliance.server.name],
        delay=10,
        num_sec=240,
        fail_func=red_hat_updates.refresh
    )

    wait_for(
        func=appliance.is_registration_complete,
        func_args=[used_repo_or_channel],
        delay=20,
        num_sec=400
    )
Exemplo n.º 6
0
def update_embedded_appliance(enabled_embedded_appliance, appliance):
    with enabled_embedded_appliance:
        red_hat_updates = RedHatUpdates(
            service='rhsm',
            url=conf.cfme_data['redhat_updates']['registration']['rhsm']
            ['url'],
            username=conf.credentials['rhsm']['username'],
            password=conf.credentials['rhsm']['password'],
            set_default_repository=True)
        red_hat_updates.update_registration(validate=False)
        red_hat_updates.check_updates()
        wait_for(func=red_hat_updates.checked_updates,
                 func_args=[appliance.server.name],
                 delay=10,
                 num_sec=100,
                 fail_func=red_hat_updates.refresh)
        if red_hat_updates.platform_updates_available():
            red_hat_updates.update_appliances()
        return enabled_embedded_appliance
Exemplo n.º 7
0
def update_appliance(appliance):
    appliance.browser_steal = True
    with appliance:
        red_hat_updates = RedHatUpdates(
            service="rhsm",
            url=conf.cfme_data["redhat_updates"]["registration"]["rhsm"]["url"],
            username=conf.credentials["rhsm"]["username"],
            password=conf.credentials["rhsm"]["password"],
            set_default_repository=True,
        )
        red_hat_updates.update_registration(validate=False)
        red_hat_updates.check_updates()
        wait_for(
            func=red_hat_updates.checked_updates,
            func_args=[appliance.server.name],
            delay=10,
            num_sec=600,
            fail_func=red_hat_updates.refresh,
        )
        if red_hat_updates.platform_updates_available():
            red_hat_updates.update_appliances()
Exemplo n.º 8
0
def test_rh_updates(appliance_preupdate, appliance):
    """ Tests whether the update button in the webui functions correctly

    Polarion:
        assignee: jhenner
        caseimportance: high
        casecomponent: Configuration
        initialEstimate: 1/4h
    """

    set_default_repo = True

    with appliance_preupdate:
        red_hat_updates = RedHatUpdates(
            service='rhsm',
            url=conf.cfme_data['redhat_updates']['registration']['rhsm']['url'],
            username=conf.credentials['rhsm']['username'],
            password=conf.credentials['rhsm']['password'],
            set_default_repository=set_default_repo
        )
        red_hat_updates.update_registration(validate=False)

        red_hat_updates.check_updates()

        wait_for(
            func=red_hat_updates.checked_updates,
            func_args=[appliance.server.name],
            delay=10,
            num_sec=100,
            fail_func=red_hat_updates.refresh
        )
        if red_hat_updates.platform_updates_available():
            red_hat_updates.update_appliances()

    def is_package_updated(appliance):
        """Checks if cfme-appliance package is at version 99"""
        result = appliance.ssh_client.run_command('rpm -qa cfme-appliance | grep 99')
        return result.success

    wait_for(is_package_updated, func_args=[appliance_preupdate], num_sec=900)
    result = appliance_preupdate.ssh_client.run_command(
        'rpm -qa cfme-appliance | grep 99')
    assert result.success
def update_embedded_appliance(enabled_embedded_appliance, appliance):
    with enabled_embedded_appliance:
        red_hat_updates = RedHatUpdates(
            service='rhsm',
            url=conf.cfme_data['redhat_updates']['registration']['rhsm']['url'],
            username=conf.credentials['rhsm']['username'],
            password=conf.credentials['rhsm']['password'],
            set_default_repository=True
        )
        red_hat_updates.update_registration(validate=False)
        red_hat_updates.check_updates()
        wait_for(
            func=red_hat_updates.checked_updates,
            func_args=[appliance.server.name],
            delay=10,
            num_sec=100,
            fail_func=red_hat_updates.refresh
        )
        if red_hat_updates.platform_updates_available():
            red_hat_updates.update_appliances()
        return enabled_embedded_appliance
Exemplo n.º 10
0
def update_appliance(appliance):
    with appliance:
        red_hat_updates = RedHatUpdates(
            service="rhsm",
            url=conf.cfme_data["redhat_updates"]["registration"]["rhsm"]["url"],
            username=conf.credentials["rhsm"]["username"],
            password=conf.credentials["rhsm"]["password"],
            set_default_repository=True,
        )
        red_hat_updates.update_registration(validate=False)
        red_hat_updates.check_updates()
        wait_for(
            func=red_hat_updates.checked_updates,
            func_args=[appliance.server.name],
            delay=10,
            num_sec=100,
            fail_func=red_hat_updates.refresh,
        )
        if red_hat_updates.platform_updates_available():
            red_hat_updates.update_appliances()
        return appliance
def test_rh_registration(appliance, request, reg_method, reg_data, proxy_url, proxy_creds):
    """ Tests whether an appliance can be registered againt RHSM and SAT6 """
    repo = reg_data.get('enable_repo')
    if not repo:
        set_default_repo = True
    else:
        set_default_repo = False

    if proxy_url:
        use_proxy = True
        proxy_username = proxy_creds['username']
        proxy_password = proxy_creds['password']
    else:
        use_proxy = False
        proxy_url = None
        proxy_username = None
        proxy_password = None
    red_hat_updates = RedHatUpdates(
        service=reg_method,
        url=reg_data['url'],
        username=conf.credentials[reg_method]['username'],
        password=conf.credentials[reg_method]['password'],
        repo_name=repo,
        organization=reg_data.get('organization'),
        use_proxy=use_proxy,
        proxy_url=proxy_url,
        proxy_username=proxy_username,
        proxy_password=proxy_password,
        set_default_repository=set_default_repo
    )
    red_hat_updates.update_registration(validate=False if reg_method != 'sat6' else True)

    used_repo_or_channel = red_hat_updates.get_repository_names()

    red_hat_updates.register_appliances()  # Register all

    request.addfinalizer(appliance.unregister)

    wait_for(
        func=red_hat_updates.is_registering,
        func_args=[appliance.server.name],
        delay=10,
        num_sec=100,
        fail_func=red_hat_updates.refresh
    )

    '''if/else added to overcome bz #1463588 these can be removed once fixed'''

    if reg_method == 'rhsm':
        wait_for(
            func=red_hat_updates.is_registered,
            handle_exception=True,
            func_args=[appliance.server.name],
            delay=40,
            num_sec=400,
            fail_func=red_hat_updates.refresh
        )
    else:
        # First registration with sat6 fails; we need to click it after this failure
        wait_for(
            func=red_hat_updates.is_registered,
            func_args=[appliance.server.name],
            delay=50,
            num_sec=1200,
            fail_func=red_hat_updates.register_appliances
        )

    wait_for(
        func=appliance.is_registration_complete,
        func_args=[used_repo_or_channel],
        delay=20,
        num_sec=400
    )
Exemplo n.º 12
0
def test_rh_registration(appliance, request, reg_method, reg_data, proxy_url, proxy_creds):
    """ Tests whether an appliance can be registered againt RHSM and SAT6 """
    repo = reg_data.get('enable_repo')
    if not repo:
        set_default_repo = True
    else:
        set_default_repo = False

    if proxy_url:
        use_proxy = True
        proxy_username = proxy_creds['username']
        proxy_password = proxy_creds['password']
    else:
        use_proxy = False
        proxy_url = None
        proxy_username = None
        proxy_password = None
    red_hat_updates = RedHatUpdates(
        service=reg_method,
        url=reg_data['url'],
        username=conf.credentials[reg_method]['username'],
        password=conf.credentials[reg_method]['password'],
        repo_name=repo,
        organization=reg_data.get('organization'),
        use_proxy=use_proxy,
        proxy_url=proxy_url,
        proxy_username=proxy_username,
        proxy_password=proxy_password,
        set_default_repository=set_default_repo
    )
    red_hat_updates.update_registration(validate=False if reg_method != 'sat6' else True)

    used_repo_or_channel = red_hat_updates.get_repository_names()

    red_hat_updates.register_appliances()  # Register all

    request.addfinalizer(appliance.unregister)

    wait_for(
        func=red_hat_updates.is_registering,
        func_args=[appliance.server.name],
        delay=10,
        num_sec=100,
        fail_func=red_hat_updates.refresh
    )

    '''if/else added to overcome bz #1463588 these can be removed once fixed'''

    if reg_method == 'rhsm':
        wait_for(
            func=red_hat_updates.is_registered,
            handle_exception=True,
            func_args=[appliance.server.name],
            delay=40,
            num_sec=400,
            fail_func=red_hat_updates.refresh
        )
    else:
        # First registration with sat6 fails; we need to click it after this failure
        wait_for(
            func=red_hat_updates.is_registered,
            func_args=[appliance.server.name],
            delay=50,
            num_sec=1200,
            fail_func=red_hat_updates.register_appliances
        )

    wait_for(
        func=appliance.is_registration_complete,
        func_args=[used_repo_or_channel],
        delay=20,
        num_sec=400
    )
Exemplo n.º 13
0
def test_rh_registration(temp_appliance_preconfig_funcscope, request,
                         reg_method, reg_data, proxy_url, proxy_creds):
    """ Tests whether an appliance can be registered against RHSM and SAT6

    Polarion:
        assignee: jhenner
        caseimportance: high
        casecomponent: Configuration
        initialEstimate: 1/12h

    Bugzilla:
        1532201
    """
    repo = reg_data.get('enable_repo')
    if not repo:
        set_default_repo = True
    else:
        set_default_repo = False

    if proxy_url:
        use_proxy = True
        proxy_username = proxy_creds['username']
        proxy_password = proxy_creds['password']
    else:
        use_proxy = False
        proxy_url = None
        proxy_username = None
        proxy_password = None

    with temp_appliance_preconfig_funcscope as appliance:
        red_hat_updates = RedHatUpdates(
            service=reg_method,
            url=reg_data['url'],
            username=conf.credentials[reg_method]['username'],
            password=conf.credentials[reg_method]['password'],
            repo_name=repo,
            organization=reg_data.get('organization'),
            use_proxy=use_proxy,
            proxy_url=proxy_url,
            proxy_username=proxy_username,
            proxy_password=proxy_password,
            set_default_repository=set_default_repo)

        red_hat_updates.update_registration(
            validate=False if reg_method != 'sat6' else True)

        used_repo_or_channel = red_hat_updates.get_repository_names()

        red_hat_updates.register_appliances()  # Register all
        request.addfinalizer(appliance.unregister)

        wait_for(func=red_hat_updates.is_registering,
                 func_args=[appliance.server.name],
                 delay=10,
                 num_sec=240,
                 fail_func=red_hat_updates.refresh)

        # This bit automates BZ#1673136
        wait_for(func=red_hat_updates.is_subscribed,
                 func_args=[appliance.server.name],
                 delay=10,
                 num_sec=600,
                 fail_func=red_hat_updates.refresh)

        assert appliance.is_registration_complete(used_repo_or_channel)