Robottelo

Robottelo is a test suite which exercises The Foreman. All tests are automated, suited for use in a continuous integration environment, and data driven. There are three types of tests:

Quickstart

The following is only a brief setup guide for Robottelo. The section on Running the Tests provides a more comprehensive guide to using Robottelo.

Robottelo requires SSH access to the Satellite 6 system under test, and this SSH access is implemented by Paramiko. Install the headers for the following to ensure that Paramiko’s dependencies build correctly:

  • OpenSSL

  • Python development headers

  • libffi

Recommendation: Create a virtual python environment for the following setup.

Create virtual environment for python 3.x:: $ python3 -m venv <venv_name> To activate virtual environment: $ source <venv_name>/bin/activate To end the session: $ deactivate

On Fedora, you can install these with the following command:

For python3.x:

dnf install -y gcc git libffi-devel openssl-devel python38-devel redhat-rpm-config libcurl-devel libxml2-devel

On Red Hat Enterprise Linux 7, you can install these with the following command:

yum install -y gcc git libffi-devel openssl-devel python38-devel redhat-rpm-config libcurl-devel libxml2-devel

For more information, see Paramiko: Installing.

Get the source code and install dependencies:

$ git clone git://github.com/SatelliteQE/robottelo.git
$ export PYCURL_SSL_LIBRARY=<ssl library>
$ pip install -r requirements.txt

Notes: * To determine ssl library, check http://pycurl.io/docs/latest/install.html#ssl

That’s it! You can now go ahead and start testing The Foreman. However, there are a few other things you may wish to do before continuing:

1. You may want to install development tools (such as gcc) for your OS. If running Fedora or Red Hat Enterprise Linux, execute yum groupinstall "Development Tools". Make sure to use dnf instead of yum if dnf is available on your system. 2. You may wish to install the optional dependencies listed in requirements-optional.txt. (Use pip, as shown above.) They are required for tasks like working with certificates, running the internal robottelo test suite and checking code quality with pre-commit.

Robottelo on Docker

Robottelo is also available on dockerhub.:

$ docker pull satelliteqe/robottelo

It also can be built locally using the Dockerfile, in the main directory.:

$ docker build -t robottelo .

In order to run tests, you will need to mount your robottelo.properties file.:

$ docker run -v {path to robottelo dir}/robottelo.properties:/robottelo/robottelo.properties satelliteqe/robottelo <test command>

You can also mount the entire robottelo directory to include the properties file and any new tests you have written.:

$ docker run -it -v {path to robottelo dir}:/robottelo satelliteqe/robottelo /bin/bash

Notes:

  • CLI tests run easiest if you include the root credentials in server.yaml

  • UI tests should be configured to run through your SauceLabs account.

Running the Tests

Before running any tests, you must create a configuration file:

$ cp virtwho.properties.sample ./virtwho.properties
$ vi virtwho.properties
$ cd conf
$ cp broker.yaml.template ./broker.yaml
$ vi broker.yaml
$ cp robottelo.yaml.template ./robottelo.yaml
$ vi robottelo.yaml
$ cp server.yaml.template ./server.yaml
$ vi server.yaml

That done, you can run tests using make:

$ make test-robottelo
$ make test-docstrings
$ make test-foreman-api
$ make test-foreman-cli
$ make test-foreman-ui
$ make test-foreman-smoke

Robottelo provides two test suites, one for testing Robottelo itself and another for testing Foreman/Satellite 6. Robottelo’s tests are under the tests/robottelo directory and the Foreman/Satellite 6 tests are under the tests/foreman directory.

If you want to run tests without the aid of make, you can do that with either pytest , unittest or nose. Just specify the path for the test suite you want to run:

$ pytest tests/robottelo
$ pytest tests/foreman
$ python -m unittest discover -s tests/robottelo -t .
$ python -m unittest discover -s tests/foreman -t .
$ nosetests tests/robottelo
$ nosetests tests/foreman

The following sections discuss, in detail, how to update the configuration file and run tests directly.

Initial Configuration

To configure Robottelo, multiple template yaml files are present to execute different test cases in Robottelo. 1. server.yaml : Populate server.yaml with ssh credentials and ssh key path. Then, edit the configuration file so that at least the following attributes are set:

HOSTNAMES=[LIST OF FULLY QUALIFIED DOMAIN NAMES OR IP ADDRESSES] SSH_USERNAME=[SSH USERNAME] SSH_PASSWORD=[SSH PASSWORD] / SSH_KEY=[PATH TO YOUR SSH KEY] / SSH_KEY_STRING = [SSH KEY AS STRING]

Note that you only need to configure the SSH key if you want to run CLI tests. There are other settings to configure what web browser to use for UI tests and even configuration to run the automation using SauceLabs. For more information about what web browsers you can use, check Selenium’s WebDriver documentation.

Using environment variables

Each of the sections in the robottelo.properties file can be mapped to an environment variable prefixed with ROBOTTELO_ so for example if you want to override the server.hostname without changing the properties file you can do:

$ export ROBOTTELO_SERVER_HOSTNAME=other.hostname.com

The envars follows the format ROBOTTELO_{SECTION}_{VALUE} all uppercase, more examples:

$ export ROBOTTELO_SERVER_SSH_KEY=path/to/your/key
$ export ROBOTTELO_BUGZILLA_API_KEY=sdfsdg654g8df4gdf6g4df8g468dfg

Running the UI Tests in headless mode

You can run browser for UI tests in headless mode by setting browser option in robottelo.properties file. Currently it is supported only for chrome

browseroptions=headless

Testing With Pytest

To run all tests:

$ pytest

It is possible to run a specific subset of tests:

$ pytest test_case.py
$ pytest test_case.py::TestClass
$ pytest test_case.py::TestClass::test_case_name

To get more verbose output, or run multiple tests:

$ pytest tests/ -v
$ pytest tests/robottelo/test_decorators.py \

tests/robottelo/test_cli.py

To test The Foreman’s API, CLI or UI, use the following commands respectively:

$ pytest tests/foreman/api/
$ pytest tests/foreman/cli/
$ pytest tests/foreman/ui/

To collect from three directories in one run:

$ pytest tests/foreman/{cli,api,ui}/test_host.py

To search in testcase names, in this case it will run just negative tests:

$ pytest tests/foreman/cli/test_host.py -k negative

To run tests in several threads, in this case 4:

$ pytest tests/foreman/cli/test_host.py -n 4

For more information about Python’s pytest module, read the documentation.

Testing With Unittest

To run all tests:

$ python -m unittest discover \

–start-directory tests/ –top-level-directory .

It is possible to run a specific subset of tests:

$ python -m unittest tests.robottelo.test_decorators
$ python -m unittest tests.robottelo.test_decorators.DataDecoratorTestCase
$ python -m unittest tests.robottelo.test_decorators.DataDecoratorTestCase.test_data_decorator_smoke

To get more verbose output, or run multiple tests:

$ python -m unittest discover -s tests/ -t . -v
$ python -m unittest \

tests.robottelo.test_decorators tests.robottelo.test_cli

To test The Foreman’s API, CLI or UI, use the following commands respectively:

$ python -m unittest discover -s tests/foreman/api/
$ python -m unittest discover -s tests/foreman/cli/
$ python -m unittest discover -s tests/foreman/ui/

For more information about Python’s unittest module, read the documentation.

Testing With Nose

You must have nose installed to execute the nosetests command.

To run all tests:

$ nosetests

It is possible to run a specific subset of tests:

$ nosetests tests.robottelo.test_decorators
$ nosetests tests.robottelo.test_decorators:DataDecoratorTestCase
$ nosetests tests.robottelo.test_decorators:DataDecoratorTestCase.test_data_decorator_smoke

To get more verbose output, or run multiple tests:

$ nosetests -v
$ nosetests tests.robottelo.test_decorators tests.robottelo.test_cli

To test The Foreman’s API, CLI or UI, use the following commands respectively:

$ nosetests tests.foreman.api
$ nosetests tests.foreman.cli
$ nosetests tests.foreman.ui

Many of the existing tests use subTest to allow for a more data-driven methodology. In order to run a specific test you need to override the way nosetests discovers test names. For instance, if you wanted to run only the test_positive_create_1 data-driven tests for the foreman.cli.test_org module:

$ nosetests -m test_positive_create_1 tests.foreman.cli.test_org

Running UI Tests On a Docker Browser

It is possible to run UI tests within a docker container. To do this:

  • Install docker. It is provided by the docker package on Fedora and Red

Hat. Be aware that the package may call docker-io on old OS releases. * Make sure that docker is up and running and the user that will run robottelo has permission to run docker commands. For more information check the docker installation guide https://docs.docker.com/engine/installation/. * Pull the selenium/standalone-firefox image * Set browser=docker at the [robottelo] section in the configuration file robottelo.properties.

Once you’ve performed these steps, UI tests will no longer launch a web browser on your system. Instead, UI tests launch a web browser within a docker container.

Running UI Tests On SauceLabs

It is possible to run UI tests on SauceLabs. To do this:

  • Set browser=saucelabs at the [robottelo] section in the configuration

file robottelo.properties. * Select the browser type by setting webdriver at the [robottelo] section in the configuration file. Valid values are firefox, chrome and ie. * Fill saucelabs_user and saucelabs_key at the [robottelo] section in the configuration file with your Sauce OnDemand credentials. * If the machine where Satellite 6 is installed is on a VPN or behind a firewall make sure to have SauceConnect running.

Miscellany

API Reference

This page contains auto-generated API reference documentation 1.

robottelo

This module contains helper code used by tests.foreman module.

This module is subservient to tests.foreman, and exists solely for the sake of helping that module get its work done. For example, tests.foreman.cli relies upon robottelo.cli. More generally: code in tests calls code in robottelo, but not the other way around.

Subpackages

robottelo.api
Submodules
robottelo.api.utils

Module containing convenience functions for working with the API.

Module Contents
Classes

templateupdate

Context Manager to unlock lock template for updating

Functions

call_entity_method_with_timeout(entity_callable, timeout=300, **kwargs)

Call Entity callable with a custom timeout

enable_rhrepo_and_fetchid(basearch, org_id, product, repo, reposet, releasever)

Enable a RedHat Repository and fetches it’s Id.

promote(content_view_version, environment_id, force=False)

Call content_view_version.promote(…).

upload_manifest(organization_id, manifest)

Call nailgun.entities.Subscription.upload.

publish_puppet_module(puppet_modules, repo_url, organization_id=None)

Creates puppet repo, sync it via provided url and publish using

delete_puppet_class(puppetclass_name, puppet_module=None, proxy_hostname=None, environment_name=None)

Removes puppet class entity and uninstall puppet module from Capsule if

create_sync_custom_repo(org_id=None, product_name=None, repo_name=None, repo_url=None, repo_type=None, repo_unprotected=True, docker_upstream_name=None)

Create product/repo, sync it and returns repo_id

enable_sync_redhat_repo(rh_repo, org_id, timeout=1500)

Enable the RedHat repo, sync it and returns repo_id

cv_publish_promote(name=None, env_name=None, repo_id=None, org_id=None)

Create, publish and promote CV to selected environment

one_to_one_names(name)

Generate the names Satellite might use for a one to one field.

one_to_many_names(name)

Generate the names Satellite might use for a one to many field.

configure_provisioning(org=None, loc=None, compute=False, os=None)

Create and configure org, loc, product, repo, cv, env. Update proxy,

create_role_permissions(role, permissions_types_names, search=None)

Create role permissions found in dict permissions_types_names.

wait_for_tasks(search_query, search_rate=1, max_tries=10, poll_rate=None, poll_timeout=None)

Search for tasks by specified search query and poll them to ensure that

wait_for_syncplan_tasks(repo_backend_id=None, timeout=10, repo_name=None)

Search the pulp tasks and identify repositories sync tasks with

wait_for_errata_applicability_task(host_id, from_when, search_rate=1, max_tries=10, poll_rate=None, poll_timeout=15)

Search the generate applicability task for given host and make sure it finishes

create_discovered_host(name=None, ip_address=None, mac_address=None, options=None)

Creates a discovered host.

update_vm_host_location(vm_client, location_id)

Update vm client host location.

check_create_os_with_title(os_title)

Check if the OS is present, if not create the required OS

attach_custom_product_subscription(prod_name=None, host_name=None)

Attach custom product subscription to client host

update_provisioning_template(name=None, old=None, new=None)

Update provisioning template content

apply_package_filter(content_view, repo, package, inclusion=True)

Apply package filter on content view

create_org_admin_role(orgs, locs, name=None)

Helper function to create org admin role for particular

create_org_admin_user(orgs, locs)

Helper function to create an Org Admin user by assigning org admin role and assign

skip_yum_update_during_provisioning(template=None, reverse=False)

Hides the yum update command with echo text

set_hammer_api_timeout(timeout=-1, reverse=False)

Set hammer API request timeout on Satellite

update_rhsso_settings_in_satellite(revert=False)

Update or Revert the RH-SSO settings in satellite

robottelo.api.utils.call_entity_method_with_timeout(entity_callable, timeout=300, **kwargs)

Call Entity callable with a custom timeout

:param entity_callable, the entity method object to call :param timeout: the time to wait for the method call to finish :param kwargs: the kwargs to pass to the entity callable

Usage:
call_entity_method_with_timeout(

entities.Repository(id=repo_id).sync, timeout=1500)

robottelo.api.utils.enable_rhrepo_and_fetchid(basearch, org_id, product, repo, reposet, releasever)

Enable a RedHat Repository and fetches it’s Id.

Parameters
  • org_id (str) – The organization Id.

  • product (str) – The product name in which repository exists.

  • reposet (str) – The reposet name in which repository exists.

  • repo (str) – The repository name who’s Id is to be fetched.

  • basearch (str) – The architecture of the repository.

  • optional releasever (str) – The releasever of the repository.

Returns

Returns the repository Id.

Return type

str

robottelo.api.utils.promote(content_view_version, environment_id, force=False)

Call content_view_version.promote(…).

Parameters
  • content_view_version – A nailgun.entities.ContentViewVersion object.

  • environment_id – An environment ID.

  • force – Whether to force the promotion or not. Only needed if promoting to a lifecycle environment that is not the next in order of sequence.

Returns

Whatever nailgun.entities.ContentViewVersion.promote returns.

robottelo.api.utils.upload_manifest(organization_id, manifest)

Call nailgun.entities.Subscription.upload.

Parameters
  • organization_id – An organization ID.

  • manifest – A file object referencing a Red Hat Satellite 6 manifest.

Returns

Whatever nailgun.entities.Subscription.upload returns.

robottelo.api.utils.publish_puppet_module(puppet_modules, repo_url, organization_id=None)

Creates puppet repo, sync it via provided url and publish using Content View publishing mechanism. It makes puppet class available via Puppet Environment created by Content View and returns Content View entity.

Parameters
  • puppet_modules – List of dictionaries with module ‘author’ and module ‘name’ fields.

  • repo_url (str) – Url of the repo that can be synced using pulp: pulp repo or puppet forge.

  • organization_id – Organization id that is shared between created entities.

Returns

nailgun.entities.ContentView entity.

robottelo.api.utils.delete_puppet_class(puppetclass_name, puppet_module=None, proxy_hostname=None, environment_name=None)

Removes puppet class entity and uninstall puppet module from Capsule if puppet module name and Capsule details provided.

Parameters
  • puppetclass_name (str) – Name of the puppet class entity that should be removed.

  • puppet_module (str) – Name of the module that should be uninstalled via puppet.

  • proxy_hostname (str) – Hostname of the Capsule from which puppet module should be removed.

  • environment_name (str) – Name of environment where puppet module was imported.

robottelo.api.utils.create_sync_custom_repo(org_id=None, product_name=None, repo_name=None, repo_url=None, repo_type=None, repo_unprotected=True, docker_upstream_name=None)

Create product/repo, sync it and returns repo_id

robottelo.api.utils.enable_sync_redhat_repo(rh_repo, org_id, timeout=1500)

Enable the RedHat repo, sync it and returns repo_id

robottelo.api.utils.cv_publish_promote(name=None, env_name=None, repo_id=None, org_id=None)

Create, publish and promote CV to selected environment

robottelo.api.utils.one_to_one_names(name)

Generate the names Satellite might use for a one to one field.

Example of usage:

>>> one_to_many_names('person') == {'person_name', 'person_id'}
True
Parameters

name – A field name.

Returns

A set including both name and variations on name.

robottelo.api.utils.one_to_many_names(name)

Generate the names Satellite might use for a one to many field.

Example of usage:

>>> one_to_many_names('person') == {'person', 'person_ids', 'people'}
True
Parameters

name – A field name.

Returns

A set including both name and variations on name.

robottelo.api.utils.configure_provisioning(org=None, loc=None, compute=False, os=None)

Create and configure org, loc, product, repo, cv, env. Update proxy, domain, subnet, compute resource, provision templates and medium with previously created entities and create a hostgroup using all mentioned entities.

Parameters
  • org (str) – Default Organization that should be used in both host discovering and host provisioning procedures

  • loc (str) – Default Location that should be used in both host discovering and host provisioning procedures

  • compute (bool) – If False creates a default Libvirt compute resource

  • os (str) – Specify the os to be used while provisioning and to associate related entities to the specified os.

Returns

List of created entities that can be re-used further in provisioning or validation procedure (e.g. hostgroup or domain)

robottelo.api.utils.create_role_permissions(role, permissions_types_names, search=None)

Create role permissions found in dict permissions_types_names.

Parameters
  • role – nailgun.entities.Role

  • permissions_types_names – a dict containing resource types and permission names to add to the role.

  • search

    string that contains search criteria that should be applied to the filter

    example usage:

    permissions_types_names = {
        None: ['access_dashboard'],
        'Organization': ['view_organizations'],
        'Location': ['view_locations'],
        'Katello::KTEnvironment': [
            'view_lifecycle_environments',
            'edit_lifecycle_environments',
            'promote_or_remove_content_views_to_environments'
        ]
    }
    role = entities.Role(name='example_role_name').create()
    create_role_permissions(
        role,
        permissions_types_names,
        'name = {0}'.format(lce.name)
    )
    

robottelo.api.utils.wait_for_tasks(search_query, search_rate=1, max_tries=10, poll_rate=None, poll_timeout=None)

Search for tasks by specified search query and poll them to ensure that task has finished.

Parameters
  • search_query – Search query that will be passed to API call.

  • search_rate – Delay between searches.

  • max_tries – How many times search should be executed.

  • poll_rate – Delay between the end of one task check-up and the start of the next check-up. Parameter for nailgun.entities.ForemanTask.poll() method.

  • poll_timeout – Maximum number of seconds to wait until timing out. Parameter for nailgun.entities.ForemanTask.poll() method.

Returns

List of nailgun.entities.ForemanTasks entities.

Raises

AssertionError. If not tasks were found until timeout.

robottelo.api.utils.wait_for_syncplan_tasks(repo_backend_id=None, timeout=10, repo_name=None)

Search the pulp tasks and identify repositories sync tasks with specified name or backend_identifier

Parameters
  • repo_backend_id – The Backend ID for the repository to identify the repo in Pulp environment

  • timeout – Value to decided how long to check for the Sync task

  • repo_name – If repo_backend_id can not be passed, pass the repo_name

robottelo.api.utils.wait_for_errata_applicability_task(host_id, from_when, search_rate=1, max_tries=10, poll_rate=None, poll_timeout=15)

Search the generate applicability task for given host and make sure it finishes

Parameters
  • host_id (int) – Content host ID of the host where we are regenerating applicability.

  • from_when (int) – Timestamp (in UTC) to limit number of returned tasks to investigate.

  • search_rate (int) – Delay between searches.

  • max_tries (int) – How many times search should be executed.

  • poll_rate (int) – Delay between the end of one task check-up and the start of the next check-up. Parameter for nailgun.entities.ForemanTask.poll() method.

  • poll_timeout (int) – Maximum number of seconds to wait until timing out. Parameter for nailgun.entities.ForemanTask.poll() method.

Returns

Relevant errata applicability task.

Raises

AssertionError. If not tasks were found for given host until timeout.

robottelo.api.utils.create_discovered_host(name=None, ip_address=None, mac_address=None, options=None)

Creates a discovered host.

Parameters
  • name (str) – Name of discovered host.

  • ip_address (str) – A valid ip address.

  • mac_address (str) – A valid mac address.

  • options (dict) – additional facts to add to discovered host

Returns

dict of entities.DiscoveredHost facts.

robottelo.api.utils.update_vm_host_location(vm_client, location_id)

Update vm client host location.

Parameters
  • vm_client – A subscribed Virtual Machine client instance.

  • location_id – The location id to update the vm_client host with.

robottelo.api.utils.check_create_os_with_title(os_title)

Check if the OS is present, if not create the required OS

Parameters

os_title – OS title to check, and create (like: RedHat 7.5)

Returns

Created or found OS

robottelo.api.utils.attach_custom_product_subscription(prod_name=None, host_name=None)

Attach custom product subscription to client host :param str prod_name: custom product name :param str host_name: client host name

class robottelo.api.utils.templateupdate(temp)

Context Manager to unlock lock template for updating

__enter__(self)

Unlocks template for update

__exit__(self, exc_type, exc_val, exc_tb)

Locks template after update

robottelo.api.utils.update_provisioning_template(name=None, old=None, new=None)

Update provisioning template content

Parameters
  • name (str) – template provisioning name

  • old (str) – current content

  • new (str) – replace content

Return bool

True/False

robottelo.api.utils.apply_package_filter(content_view, repo, package, inclusion=True)

Apply package filter on content view

Parameters
  • content_view – entity content view

  • repo – entity repository

  • package (str) – package name to filter

  • inclusion (bool) – True/False based on include or exclude filter

:return list : list of content view versions

robottelo.api.utils.create_org_admin_role(orgs, locs, name=None)

Helper function to create org admin role for particular organizations and locations by cloning ‘Organization admin’ role.

Parameters
  • orgs (list) – The list of organizations for which the org admin is being created

  • locs (list) – The list of locations for which the org admin is being created

  • name (str) – The name of cloned Org Admin role, autogenerates if None provided

Return dict

The object of `nailgun.Role` of Org Admin role.

robottelo.api.utils.create_org_admin_user(orgs, locs)

Helper function to create an Org Admin user by assigning org admin role and assign taxonomies to Role and User

The taxonomies for role and user will be assigned based on parameters of this function

Return User

Returns the `nailgun.entities.User` object with passwd attr

robottelo.api.utils.skip_yum_update_during_provisioning(template=None, reverse=False)

Hides the yum update command with echo text

Parameters
  • template (str) – The template name where the yum update will be hidden

  • reverse (bool) – Reverses the echo text to yum update

Returns

Boolean True on success else exception

robottelo.api.utils.set_hammer_api_timeout(timeout=- 1, reverse=False)

Set hammer API request timeout on Satellite

Parameters
  • timeout (int) – request timeout in seconds

  • reverse (bool) – Reverses the request timeout

Returns

ssh.command

robottelo.api.utils.update_rhsso_settings_in_satellite(revert=False)

Update or Revert the RH-SSO settings in satellite

robottelo.cli
Submodules
robottelo.cli.activationkey

Usage:

hammer activation-key [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

add-host-collection           Associate a resource
add-subscription              Add subscription
content-override              Override product content defaults
copy                          Copy an activation key
create                        Create an activation key
delete                        Destroy an activation key
host-collections              List associated host collections
info                          Show an activation key
list                          List activation keys
product-content               List associated products
remove-host-collection        Disassociate a resource
remove-subscription           Remove subscription
subscriptions                 List associated subscriptions
update                        Update an activation key
Module Contents
Classes

ActivationKey

Manipulates Katello’s activation-key.

class robottelo.cli.activationkey.ActivationKey

Bases: robottelo.cli.base.Base

Manipulates Katello’s activation-key.

command_base = activation-key
classmethod add_host_collection(cls, options=None)

Associate a resource

classmethod add_subscription(cls, options=None)

Add subscription

classmethod content_override(cls, options=None)

Override product content defaults

classmethod copy(cls, options=None)

Copy an activation key

classmethod host_collection(cls, options=None)

List associated host collections

classmethod product_content(cls, options=None)

List associated products

classmethod remove_host_collection(cls, options=None)

Remove the associated resource

classmethod remove_repository(cls, options=None)

Disassociate a resource

classmethod remove_subscription(cls, options=None)

Remove subscription

classmethod subscriptions(cls, options=None, output_format=None)

List associated subscriptions

robottelo.cli.admin
Usage:

hammer admin [OPTIONS] SUBCOMMAND [ARG] …

Parameters:

SUBCOMMAND Subcommand [ARG] … Subcommand arguments

Subcommands:

logging Logging verbosity level setup

Options:
-h, --help

Print help

Module Contents
Classes

Admin

Administrative server-side tasks

class robottelo.cli.admin.Admin

Bases: robottelo.cli.base.Base

Administrative server-side tasks

command_base = admin
classmethod logging(cls, options=None)

Logging verbosity level setup

robottelo.cli.ansible
Usage::

ansible [OPTIONS] SUBCOMMAND [ARG] …

Parameters::

SUBCOMMAND Subcommand [ARG] … Subcommand arguments

Subcommands::

roles Manage ansible roles variables Manage ansible variables

Module Contents
Classes

Ansible

Manipulates Ansible Variables and roles.

class robottelo.cli.ansible.Ansible

Bases: robottelo.cli.base.Base

Manipulates Ansible Variables and roles.

command_base = ansible
classmethod roles_import(cls, options=None)

Import ansible roles

classmethod variables_import(cls, options=None)

Import ansible variables

classmethod roles_list(cls, options=None)

List ansible roles

robottelo.cli.architecture

Usage:

hammer architecture [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

add_operatingsystem           Associate a resource
create                        Create an architecture.
delete                        Delete an architecture.
info                          Show an architecture.
list                          List all architectures.
remove_operatingsystem        Disassociate a resource
update                        Update an architecture.
Module Contents
Classes

Architecture

Manipulates Foreman’s architecture.

class robottelo.cli.architecture.Architecture

Bases: robottelo.cli.base.Base

Manipulates Foreman’s architecture.

command_base = architecture
robottelo.cli.arfreport

Usage:

arf-report [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments
Subcommands::

delete Delete an ARF Report download Download bzipped ARF report download-html Download ARF report in HTML info Show an ARF report list List ARF reports

Module Contents
Classes

Arfreport

Manipulates Satellite’s arf-report.

class robottelo.cli.arfreport.Arfreport

Bases: robottelo.cli.base.Base

Manipulates Satellite’s arf-report.

command_base = arf-report
classmethod list(cls, options=None)

Search arf host reports

Usage:

hammer arf-report list [OPTIONS]

Options:

--location LOCATION_NAME                Location name
--location-id LOCATION_ID
--location-title LOCATION_TITLE         Location title
--order ORDER                           Sort field and order, eg. ‘id DESC’
--organization ORGANIZATION_NAME        Organization name
--organization-id ORGANIZATION_ID       Organization ID
--organization-title ORGANIZATION_TITLE Organization title
--page PAGE                             Paginate results
--per-page PER_PAGE                     Number of entries per request
--search SEARCH                         Filter results
-h, --help                              Print help
robottelo.cli.auth
Usage::

hammer auth [OPTIONS] SUBCOMMAND [ARG] …

Parameters::

SUBCOMMAND subcommand [ARG] … subcommand arguments

Subcommands::

login Set credentials logout Wipe your credentials status Information about current connections

Module Contents
Classes

Auth

Authenticates Foreman users

AuthLogin

Auth Login for Foreman CLI

class robottelo.cli.auth.Auth

Bases: robottelo.cli.base.Base

Authenticates Foreman users

command_base = auth
classmethod login(cls, options=None)

Set credentials

classmethod logout(cls, options=None)

Wipe credentials

classmethod status(cls, options=None)

Show login status

class robottelo.cli.auth.AuthLogin

Bases: robottelo.cli.base.Base

Auth Login for Foreman CLI

command_base = auth login
classmethod basic(cls, options=None)

Provide username and password

classmethod oauth(cls, options=None)

Supports for both with/without 2fa

robottelo.cli.base

Generic base class for cli hammer commands.

Module Contents
Classes

Base

@param command_base: base command of hammer.

exception robottelo.cli.base.CLIError

Bases: Exception

Indicates that a CLI command could not be run.

exception robottelo.cli.base.CLIBaseError(return_code, stderr, msg)

Bases: Exception

Indicates that a CLI command has finished with return code different from zero.

Parameters
  • return_code – CLI command return code

  • stderr – contents of the stderr

  • msg – explanation of the error

__str__(self)

Include class name, return_code, stderr and msg to string repr so assertRaisesRegexp can be used to assert error present on any attribute

__repr__(self)

Include class name return_code, stderr and msg to improve logging

exception robottelo.cli.base.CLIReturnCodeError(return_code, stderr, msg)

Bases: CLIBaseError

Error to be raised when an error occurs due to some validation error when execution hammer cli. See: https://github.com/SatelliteQE/robottelo/issues/3790 for more details

exception robottelo.cli.base.CLIDataBaseError(return_code, stderr, msg)

Bases: CLIBaseError

Error to be raised when an error occurs due to some missing parameter which cause a data base error on hammer See: https://github.com/SatelliteQE/robottelo/issues/3790 for more details

class robottelo.cli.base.Base

@param command_base: base command of hammer. See Subcommands section in hammer –help output on your Satellite.

command_base
command_sub
command_requires_org = False
hostname
logger
_db_error_regex
classmethod _handle_response(cls, response, ignore_stderr=None)

Verify return_code of the CLI command.

Check for a non-zero return code or any stderr contents.

Parameters
  • response – a SSHCommandResult object, returned by robottelo.ssh.command.

  • ignore_stderr – indicates whether to throw a warning in logs if stderr is not empty.

Returns

contents of stdout.

Raises

robottelo.cli.base.CLIReturnCodeError – If return code is different from zero.

classmethod add_operating_system(cls, options=None)

Adds OS to record.

classmethod create(cls, options=None, timeout=None)

Creates a new record using the arguments passed via dictionary.

classmethod delete(cls, options=None, timeout=None)

Deletes existing record.

classmethod delete_parameter(cls, options=None)

Deletes parameter from record.

classmethod dump(cls, options=None)

Displays the content for existing partition table.

classmethod _get_username_password(cls, username=None, password=None)

Lookup for the username and password for cli command in following order:

  1. user or password parameters

  2. foreman_admin_username or foreman_admin_password attributes

  3. foreman.admin.username or foreman.admin.password configuration

Returns

A tuple with the username and password found

Return type

tuple

classmethod execute(cls, command, hostname=None, user=None, password=None, output_format=None, timeout=None, ignore_stderr=None, return_raw_response=None, connection_timeout=None)

Executes the cli command on the server via ssh

classmethod exists(cls, options=None, search=None)

Search for an entity using the query search[0]="search[1]"

Will be used the list command with the --search option to do the search.

If options argument already have a search key, then the search argument will not be evaluated. Which allows different search query.

classmethod info(cls, options=None, output_format=None, return_raw_response=None)

Reads the entity information.

classmethod list(cls, options=None, per_page=True, output_format='csv')

List information. @param options: ID (sometimes name works as well) to retrieve info.

classmethod puppetclasses(cls, options=None)

Lists all puppet classes.

classmethod remove_operating_system(cls, options=None)

Removes OS from record.

classmethod sc_params(cls, options=None)

Lists all smart class parameters.

classmethod set_parameter(cls, options=None)

Creates or updates parameter for a record.

classmethod update(cls, options=None, return_raw_response=None)

Updates existing record.

classmethod with_user(cls, username=None, password=None)

Context Manager for credentials

classmethod _construct_command(cls, options=None)

Build a hammer cli command based on the options passed

robottelo.cli.capsule

Usage:

hammer capsule [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

content                       Manage the capsule content
create                        Create a capsule
delete                        Delete a capsule
import-classes                Import puppet classes from puppet Capsule.
info                          Show a capsule
list                          List all capsules
refresh-features              Refresh capsule features
update                        Update a capsule
Module Contents
Classes

Capsule

Manipulates Foreman’s capsule.

class robottelo.cli.capsule.Capsule

Bases: robottelo.cli.base.Base

Manipulates Foreman’s capsule.

command_base = capsule
classmethod content_add_lifecycle_environment(cls, options)

Add lifecycle environments to the capsule.

classmethod content_available_lifecycle_environments(cls, options)

List the lifecycle environments not attached to the capsule.

classmethod content_info(cls, options)

Get current capsule synchronization status.

classmethod content_lifecycle_environments(cls, options)

List the lifecycle environments attached to the capsule.

classmethod content_remove_lifecycle_environment(cls, options)

Remove lifecycle environments from the capsule.

classmethod content_synchronization_status(cls, options)

Get current capsule synchronization status.

classmethod content_synchronize(cls, options, return_raw_response=None, timeout=3600)

Synchronize the content to the capsule.

classmethod import_classes(cls, options)

Import puppet classes from puppet Capsule.

classmethod refresh_features(cls, options)

Refresh capsule features.

robottelo.cli.computeprofile
Usage:

hammer compute-profile [OPTIONS] SUBCOMMAND [ARG] …

Parameters:

SUBCOMMAND Subcommand [ARG] … Subcommand arguments

Subcommands:

create Create a compute profile delete Delete a compute profile info Show a compute profile list List of compute profiles update Update a compute profile values Create update and delete Compute profile values

Options:
-h, --help

Print help Update a compute resource.

Module Contents
Classes

ComputeProfile

Manipulates Foreman’s compute-profile.

class robottelo.cli.computeprofile.ComputeProfile

Bases: robottelo.cli.base.Base

Manipulates Foreman’s compute-profile.

command_base = compute-profile
classmethod values_create(cls, options=None)

Create Compute profile values

robottelo.cli.computeresource

Usage:

hammer compute-resource [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

create                        Create a compute resource.
delete                        Delete a compute resource.
image                         View and manage compute resource's images
info                          Show an compute resource.
list                          List all compute resources.
update                        Update a compute resource.
Module Contents
Classes

ComputeResource

Manipulates Foreman’s compute resources.

class robottelo.cli.computeresource.ComputeResource

Bases: robottelo.cli.base.Base

Manipulates Foreman’s compute resources.

command_base = compute-resource
classmethod image_create(cls, options)

Create an image

classmethod image_info(cls, options)

Show an image

classmethod image_available(cls, options)

Show images available for addition

classmethod image_delete(cls, options)

delete an image

classmethod image_list(cls, options)

Show the list of images

classmethod image_update(cls, options)

update an image

classmethod networks(cls, options)

List available networks for a compute resource

robottelo.cli.content_credentials

Usage:

hammer content-credential [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

create                        Create a content credential
delete                        Destroy a content credential
info                          Show a content credential
list                          List content credentials
update                        Update a content credential
Module Contents
Classes

ContentCredential

Manipulates Foreman’s content credentials.

class robottelo.cli.content_credentials.ContentCredential

Bases: robottelo.cli.base.Base

Manipulates Foreman’s content credentials.

command_base = content-credential
command_requires_org = True
classmethod info(cls, options=None)

Gets information for a content credential

robottelo.cli.contentview

Usage:

hammer content-view [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

add-repository                Associate a resource
add-version                   Update a content view
component                     View and manage components
copy                          Copy a content view
create                        Create a content view
delete                        Delete a content view
filter                        View and manage filters
info                          Show a content view
list                          List content views
publish                       Publish a content view
puppet-module                 View and manage puppet modules
remove                        Remove versions and/or environments from a
                              content view and reassign systems and keys
remove-from-environment       Remove a content view from an environment
remove-repository             Disassociate a resource
remove-version                Remove a content view version from a
                              composite view
update                        Update a content view
version                       View and manage content view versions

Options:

-h, --help                    print help
Module Contents
Classes

ContentViewFilterRule

Manipulates content view filter rules.

ContentViewFilter

Manipulates content view filters.

ContentView

Manipulates Foreman’s content view.

class robottelo.cli.contentview.ContentViewFilterRule

Bases: robottelo.cli.base.Base

Manipulates content view filter rules.

command_base = content-view filter rule
classmethod create(cls, options=None)

Create a content-view filter rule

class robottelo.cli.contentview.ContentViewFilter

Bases: robottelo.cli.base.Base

Manipulates content view filters.

command_base = content-view filter
rule
class robottelo.cli.contentview.ContentView

Bases: robottelo.cli.base.Base

Manipulates Foreman’s content view.

command_base = content-view
filter
classmethod add_repository(cls, options)

Associate repository to a selected CV.

classmethod add_version(cls, options)

Associate version to a selected CV.

classmethod copy(cls, options)

Copy existing content-view to a new one

classmethod publish(cls, options, timeout=1500)

Publishes a new version of content-view.

classmethod version_info(cls, options, output_format=None)

Provides version info related to content-view’s version.

classmethod version_incremental_update(cls, options)

Performs incremental update of the content-view’s version

classmethod puppet_module_add(cls, options)

Associate puppet_module to selected CV

classmethod puppet_module_list(cls, options)

List content view puppet modules

classmethod puppet_module_remove(cls, options)

Remove a puppet module from the content view

classmethod version_list(cls, options)

Lists content-view’s versions.

classmethod version_promote(cls, options, timeout=600)

Promotes content-view version to next env.

classmethod version_export(cls, options, timeout=300)

Exports content-view version in given directory

classmethod version_import(cls, options, timeout=300)

Imports content-view version from a given directory

classmethod version_delete(cls, options)

Removes content-view version.

classmethod remove_from_environment(cls, options=None)

Remove content-view from an environment

classmethod remove(cls, options=None)

Remove versions and/or environments from a content view and reassign content hosts and keys

classmethod remove_version(cls, options=None)

Remove a content view version from a composite view

classmethod remove_repository(cls, options)

Remove repository from content view

classmethod component_add(cls, options=None)

Add components to the content view

classmethod component_list(cls, options=None)

List components attached to the content view

robottelo.cli.defaults

Usage:

hammer defaults [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

add                           Add a default parameter to config
delete                        Delete a default param
list                          List all the default parameters
providers                     List all the providers
Module Contents
Classes

Defaults

Manipulates Defaults entity

class robottelo.cli.defaults.Defaults

Bases: robottelo.cli.base.Base

Manipulates Defaults entity

command_base = defaults
classmethod add(cls, options=None)

Add parameter to config Usage:

hammer defaults add [OPTIONS]

Options:

--param-name OPTION_NAME      The name of the default option
                              (e.g. organization_id).
--param-value OPTION_VALUE    The value for the default option
--provider OPTION_PROVIDER    The name of the provider providing
                              the value. For list available
                              providers see `hammer defaults
                              providers`.
classmethod delete(cls, options=None)

Delete parameter from config Usage:

hammer defaults delete [OPTIONS]

Options:

--param-name OPTION_NAME      The name of the default option
robottelo.cli.discoveredhost

Usage:

hammer discovery [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

auto-provision                Auto provision a host
delete                        Delete a discovered host
facts                         Show a discovered host
info                          Show a discovered host
list                          List all discovered hosts
provision                     Provision a discovered host
reboot                        Reboot a host
refresh-facts                 Refresh the facts of a host
Module Contents
Classes

DiscoveredHost

Manipulates Discovery Hosts

class robottelo.cli.discoveredhost.DiscoveredHost

Bases: robottelo.cli.base.Base

Manipulates Discovery Hosts

command_base = discovery
classmethod provision(cls, options=None)

Manually provision discovered host

classmethod facts(cls, options=None)

Get all the facts associated with discovered host

robottelo.cli.discoveryrule

Usage:

hammer discovery-rule [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

create                        Create a discovery rule
delete                        Delete a rule
info                          Show a discovery rule
list                          List all discovery rules
update                        Update a rule
Module Contents
Classes

DiscoveryRule

Manipulates Discovery Rules

class robottelo.cli.discoveryrule.DiscoveryRule

Bases: robottelo.cli.base.Base

Manipulates Discovery Rules

command_base = discovery-rule
robottelo.cli.docker

Docker related hammer commands

Module Contents
Classes

DockerManifest

Manipulates Docker manifests

DockerTag

Manipulates Docker tags

Docker

Manipulates Docker manifests and tags

class robottelo.cli.docker.DockerManifest

Bases: robottelo.cli.base.Base

Manipulates Docker manifests

Usage:

hammer docker manifest [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

info                          Show a docker manifest
list                          List docker_manifests
command_base = docker manifest
classmethod info(cls, options=None)

Gets information about docker manifests

Usage:

hammer docker manifest info [OPTIONS]

Options:

--id ID                       a docker manifest identifier
--name NAME                   Name to search by
--repository REPOSITORY_NAME  Repository name to search by
--repository-id REPOSITORY_ID repository ID
classmethod list(cls, options=None, per_page=True)

List docker manifests

Usage:

hammer docker manifest list [OPTIONS]

Options:

--by BY                                             Field to sort the
                                                    results on
--content-view CONTENT_VIEW_NAME                    Content view name
--content-view-filter CONTENT_VIEW_FILTER_NAME      Name to search by
--content-view-filter-id CONTENT_VIEW_FILTER_ID     filter identifier
--content-view-id CONTENT_VIEW_ID                   content view
                                                    numeric identifier
--content-view-version CONTENT_VIEW_VERSION_VERSION Content view
                                                    version number
--content-view-version-id CONTENT_VIEW_VERSION_ID   Content view
                                                    version identifier
--full-results FULL_RESULTS                         Whether or not to
                                                    show all results
                                                    One of true/false,
                                                    yes/no, 1/0.
--ids IDS                                           ids to filter
                                                    content by
                                                    Comma separated
                                                    list of values.
--lifecycle-environment LIFECYCLE_ENVIRONMENT_NAME  Name to search by
--lifecycle-environment-id LIFECYCLE_ENVIRONMENT_ID
--order ORDER                                       Sort field and
                                                    order, eg.
                                                    "name DESC"
--organization ORGANIZATION_NAME                    Organization name
                                                    to search by
--organization-id ORGANIZATION_ID                   organization ID
--organization-label ORGANIZATION_LABEL             Organization label
                                                    to search by
--page PAGE                                         Page number,
                                                    starting at 1
--per-page PER_PAGE                                 Number of results
                                                    per page to return
--product PRODUCT_NAME                              Product name to
                                                    search by
--product-id PRODUCT_ID                             product numeric
                                                    identifier
--repository REPOSITORY_NAME                        Repository name to
                                                    search by
--repository-id REPOSITORY_ID                       repository ID
--search SEARCH                                     Search string
class robottelo.cli.docker.DockerTag

Bases: robottelo.cli.base.Base

Manipulates Docker tags

Usage:

hammer docker tag [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

info                          Show a docker tag
list                          List docker_tags
command_base = docker tag
classmethod info(cls, options=None)

Gets information about docker tags

Usage:

hammer docker tag info [OPTIONS]

Options:

--id ID                       a docker tag identifier
--name NAME                   Name to search by
--repository REPOSITORY_NAME  Repository name to search by
--repository-id REPOSITORY_ID repository ID
classmethod list(cls, options=None, per_page=True)

List docker tags

Usage:

hammer docker tag list [OPTIONS]

Options:

--content-view CONTENT_VIEW_NAME                    Content view
                                                    name
--content-view-filter CONTENT_VIEW_FILTER_NAME      Name to search
                                                    by
--content-view-filter-id CONTENT_VIEW_FILTER_ID     filter
                                                    identifier
--content-view-id CONTENT_VIEW_ID                   content view
                                                    numeric
                                                    identifier
--content-view-version CONTENT_VIEW_VERSION_VERSION Content view
                                                    version number
--content-view-version-id CONTENT_VIEW_VERSION_ID   Content view
                                                    version
                                                    identifier
--environment ENVIRONMENT_NAME                      Name to search
                                                    by
--environment-id ENVIRONMENT_ID
--organization ORGANIZATION_NAME                    Organization
                                                    name to search
                                                    by
--organization-id ORGANIZATION_ID                   organization ID
--organization-label ORGANIZATION_LABEL             Organization
                                                    label to search
                                                    by
--product PRODUCT_NAME                              Product name to
                                                    search by
--product-id PRODUCT_ID                             product numeric
                                                    identifier
--repository REPOSITORY_NAME                        Repository name
                                                    to search by
--repository-id REPOSITORY_ID                       repository ID
class robottelo.cli.docker.Docker

Bases: robottelo.cli.base.Base

Manipulates Docker manifests and tags

Usage:

hammer docker [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

container                     Manage docker containers
manifest                      Manage docker manifests
registry                      Manage docker registries
tag                           Manage docker tags
command_base = docker
manifest
tag
robottelo.cli.domain

Usage:

hammer domain [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

create                        Create a domain.
delete                        Delete a domain.
delete_parameter              Delete parameter for a domain.
info                          Show a domain.
list                          List of domains
set_parameter                 Create or update parameter for a domain.
update                        Update a domain.
Module Contents
Classes

Domain

Manipulates Foreman’s domains.

class robottelo.cli.domain.Domain

Bases: robottelo.cli.base.Base

Manipulates Foreman’s domains.

command_base = domain
robottelo.cli.environment

Usage:

hammer environment [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

create                        Create an environment
delete                        Delete an environment
info                          Show an environment
list                          List all environments
sc-params                     List all smart class parameters
update                        Update an environment
Module Contents
Classes

Environment

Manipulates Foreman’s environments.

class robottelo.cli.environment.Environment

Bases: robottelo.cli.base.Base

Manipulates Foreman’s environments.

command_base = environment
classmethod sc_params(cls, options=None)

List all smart class parameters.

robottelo.cli.erratum

Usage:

hammer erratum [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

info                          Show an erratum
list                          List errata
Module Contents
Classes

Erratum

Manipulates Foreman’s erratum.

class robottelo.cli.erratum.Erratum

Bases: robottelo.cli.base.Base

Manipulates Foreman’s erratum.

command_base = erratum
robottelo.cli.fact

Usage:

hammer fact [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

list                          List all fact values.
Module Contents
Classes

Fact

Searches Foreman’s facts.

class robottelo.cli.fact.Fact

Bases: robottelo.cli.base.Base

Searches Foreman’s facts.

command_base = fact
robottelo.cli.factory

Factory object creation for all CLI methods

Module Contents
Functions

create_object(cli_object, options, values)

Creates <object> with dictionary of arguments.

_entity_with_credentials(credentials, cli_entity_cls)

Create entity class using credentials. If credentials is None will

make_activation_key(options=None)

Creates an Activation Key

make_architecture(options=None)

Creates an Architecture

make_content_view(options=None)

Creates a Content View

make_content_view_with_credentials(options=None, credentials=None)

Helper function to create CV with credentials

make_content_view_filter(options=None)

Creates a Content View Filter

make_content_view_filter_rule(options=None)

Creates a Content View Filter Rule

make_discoveryrule(options=None)

Creates a Discovery Rule

make_gpg_key(options=None)

Creates a GPG Key

make_content_credential(options=None)

Creates a content credential.

make_location(options=None)

Creates a Location

make_model(options=None)

Creates a Hardware Model

make_partition_table(options=None)

Creates a Partition Table

make_product(options=None)

Creates a Product

make_product_with_credentials(options=None, credentials=None)

Helper function to create product with credentials

make_product_wait(options=None, wait_for=5)

Wrapper function for make_product to make it wait before erroring out.

make_proxy(options=None)

Creates a Proxy

make_repository(options=None)

Creates a Repository

make_repository_with_credentials(options=None, credentials=None)

Helper function to create Repository with credentials

make_role(options=None)

Creates a Role

make_filter(options=None)

Creates a Role Filter

make_scap_policy(options=None)

Creates a Scap Policy

make_subnet(options=None)

Creates a Subnet

make_sync_plan(options=None)

Creates a Sync Plan

make_host(options=None)

Creates a Host

make_fake_host(options=None)

Wrapper function for make_host to pass all required options for creation

make_host_collection(options=None)

Creates a Host Collection

make_job_invocation(options=None)

Creates a Job Invocation

make_job_template(options=None)

Creates a Job Template

make_user(options=None)

Creates a User

make_usergroup(options=None)

Creates a User Group

make_usergroup_external(options=None)

Creates an External User Group

make_ldap_auth_source(options=None)

Creates an LDAP Auth Source

make_compute_resource(options=None)

Creates a Compute Resource

make_org(options=None)

Creates an Organization

make_org_with_credentials(options=None, credentials=None)

Helper function to create organization with credentials

make_realm(options=None)

Creates a REALM

make_report_template(options=None)

Creates a Report Template

make_os(options=None)

Creates an Operating System

make_scapcontent(options=None)

Creates Scap Content

make_domain(options=None)

Creates a Domain

make_hostgroup(options=None)

Creates a Hostgroup

make_medium(options=None)

Creates a Medium

make_environment(options=None)

Creates a Puppet Environment

make_lifecycle_environment(options=None)

Creates a Lifecycle Environment

make_tailoringfile(options=None)

Creates a tailoring File

make_template(options=None)

Creates a Template

make_template_input(options=None)

Creates Template Input

make_virt_who_config(options=None)

Creates a Virt Who Configuration

activationkey_add_subscription_to_repo(options=None)

Helper function that adds subscription to an activation key

setup_org_for_a_custom_repo(options=None)

Sets up Org for the given custom repo by:

_setup_org_for_a_rh_repo(options=None)

Sets up Org for the given Red Hat repository by:

setup_org_for_a_rh_repo(options=None, force_manifest_upload=False, force_use_cdn=False)

Wrapper above _setup_org_for_a_rh_repo to use custom downstream repo

configure_env_for_provision(org=None, loc=None)

Create and configure org, loc, product, repo, env. Update proxy,

publish_puppet_module(puppet_modules, repo_url, organization_id=None)

Creates puppet repo, sync it via provided url and publish using

setup_virtual_machine(vm, org_label, rh_repos_id=None, repos_label=None, product_label=None, lce=None, activation_key=None, patch_os_release_distro=None, install_katello_agent=True)

Setup a Virtual machine with basic components and tasks.

_get_capsule_vm_distro_repos(distro)

Return the right RH repos info for the capsule setup

add_role_permissions(role_id, resource_permissions)

Create role permissions found in resource permissions dict

setup_cdn_and_custom_repositories(org_id, repos, download_policy='on_demand', synchronize=True)

Setup cdn and custom repositories

setup_cdn_and_custom_repos_content(org_id, lce_id=None, repos=None, upload_manifest=True, download_policy='on_demand', rh_subscriptions=None, default_cv=False)

Setup cdn and custom repositories, content view and activations key

vm_setup_ssh_config(vm, ssh_key_name, host, user=None)

Create host entry in vm ssh config and know_hosts files to allow vm

vm_upload_ssh_key(vm, source_key_path, destination_key_name)

Copy ssh key to virtual machine ssh path and ensure proper permission is

virt_who_hypervisor_config(config_id, virt_who_vm, org_id=None, lce_id=None, hypervisor_hostname=None, configure_ssh=False, hypervisor_user=None, subscription_name=None, exec_one_shot=False, upload_manifest=True, extra_repos=None)

Configure virtual machine as hypervisor virt-who service

make_http_proxy(options=None)

Creates a HTTP Proxy

Attributes

logger

ORG_KEYS

CONTENT_VIEW_KEYS

LIFECYCLE_KEYS

robottelo.cli.factory.logger
robottelo.cli.factory.ORG_KEYS = ['organization', 'organization-id', 'organization-label']
robottelo.cli.factory.CONTENT_VIEW_KEYS = ['content-view', 'content-view-id']
robottelo.cli.factory.LIFECYCLE_KEYS = ['lifecycle-environment', 'lifecycle-environment-id']
exception robottelo.cli.factory.CLIFactoryError

Bases: Exception

Indicates an error occurred while creating an entity using hammer

robottelo.cli.factory.create_object(cli_object, options, values)

Creates <object> with dictionary of arguments.

Parameters
  • cli_object – A valid CLI object.

  • options (dict) – The default options accepted by the cli_object create

  • values (dict) – Custom values to override default ones.

Raises

robottelo.cli.factory.CLIFactoryError – Raise an exception if object cannot be created.

Return type

dict

Returns

A dictionary representing the newly created resource.

robottelo.cli.factory._entity_with_credentials(credentials, cli_entity_cls)

Create entity class using credentials. If credentials is None will return cli_entity_cls itself

Parameters
  • credentials – tuple (login, password)

  • cli_entity_cls – Cli Entity Class

Returns

Cli Entity Class

robottelo.cli.factory.make_activation_key(options=None)

Creates an Activation Key

Parameters

options – Check options using hammer activation-key create –help on satellite.

:returns ActivationKey object

robottelo.cli.factory.make_architecture(options=None)

Creates an Architecture

Parameters

options – Check options using hammer architecture create –help on satellite.

:returns Architecture object

robottelo.cli.factory.make_content_view(options=None)

Creates a Content View

Parameters

options – Check options using hammer content-view create –help on satellite.

:returns ContentView object

robottelo.cli.factory.make_content_view_with_credentials(options=None, credentials=None)

Helper function to create CV with credentials

If credentials is None, the default credentials in robottelo.properties will be used.

robottelo.cli.factory.make_content_view_filter(options=None)

Creates a Content View Filter

Parameters

options – Check options using hammer content-view filter create –help on satellite.

:returns ContentViewFilter object

robottelo.cli.factory.make_content_view_filter_rule(options=None)

Creates a Content View Filter Rule

Parameters

options – Check options using hammer content-view filter rule create –help on satellite.

:returns ContentViewFilterRule object

robottelo.cli.factory.make_discoveryrule(options=None)

Creates a Discovery Rule

Parameters

options – Check options using hammer discovery-rule create –help on satellite.

:returns DiscoveryRule object

robottelo.cli.factory.make_gpg_key(options=None)

Creates a GPG Key

Parameters

options – Check options using hammer gpg create –help on satellite.

:returns GPGKey object

robottelo.cli.factory.make_content_credential(options=None)

Creates a content credential.

In Satellite 6.8, only gpg_key option is supported.

Parameters

options – Check options using hammer content-credential create –help on satellite.

:returns ContentCredential object

robottelo.cli.factory.make_location(options=None)

Creates a Location

Parameters

options – Check options using hammer location create –help on satellite.

:returns Location object

robottelo.cli.factory.make_model(options=None)

Creates a Hardware Model

Parameters

options – Check options using hammer model create –help on satellite.

:returns Model object

robottelo.cli.factory.make_partition_table(options=None)

Creates a Partition Table

Parameters

options – Check options using hammer partition-table create –help on satellite.

:returns PartitionTable object

robottelo.cli.factory.make_product(options=None)

Creates a Product

Parameters

options – Check options using hammer product create –help on satellite.

:returns Product object

robottelo.cli.factory.make_product_with_credentials(options=None, credentials=None)

Helper function to create product with credentials

robottelo.cli.factory.make_product_wait(options=None, wait_for=5)

Wrapper function for make_product to make it wait before erroring out.

This is a temporary workaround for BZ#1332650: Sometimes cli product create errors for no reason when there are multiple product creation requests at the sametime although the product entities are created. This workaround will attempt to wait for 5 seconds and query the product again to make sure it is actually created. If it is not found, it will fail and stop.

Note: This wrapper method is created instead of patching make_product because this issue does not happen for all entities and this workaround should be removed once the root cause is identified/fixed.

robottelo.cli.factory.make_proxy(options=None)

Creates a Proxy

Parameters

options – Check options using hammer proxy create –help on satellite.

:returns Proxy object

robottelo.cli.factory.make_repository(options=None)

Creates a Repository

Parameters

options – Check options using hammer repository create –help on satellite.

:returns Repository object

robottelo.cli.factory.make_repository_with_credentials(options=None, credentials=None)

Helper function to create Repository with credentials

robottelo.cli.factory.make_role(options=None)

Creates a Role

Parameters

options – Check options using hammer role create –help on satellite.

:returns Role object

robottelo.cli.factory.make_filter(options=None)

Creates a Role Filter

Parameters

options – Check options using hammer filter create –help on satellite.

:returns Role object

robottelo.cli.factory.make_scap_policy(options=None)

Creates a Scap Policy

Parameters

options – Check options using hammer policy create –help on satellite.

:returns Scappolicy object

robottelo.cli.factory.make_subnet(options=None)

Creates a Subnet

Parameters

options – Check options using hammer subnet create –help on satellite.

:returns Subnet object

robottelo.cli.factory.make_sync_plan(options=None)

Creates a Sync Plan

Parameters

options – Check options using hammer sync-plan create –help on satellite.

:returns SyncPlan object

robottelo.cli.factory.make_host(options=None)

Creates a Host

Parameters

options – Check options using hammer host create –help on satellite.

:returns Host object

robottelo.cli.factory.make_fake_host(options=None)

Wrapper function for make_host to pass all required options for creation of a fake host

robottelo.cli.factory.make_host_collection(options=None)

Creates a Host Collection

Parameters

options – Check options using hammer host-collection create –help on satellite.

:returns HostCollection object

robottelo.cli.factory.make_job_invocation(options=None)

Creates a Job Invocation

Parameters

options – Check options using hammer job-invocation create –help on satellite.

:returns JobInvocation object

robottelo.cli.factory.make_job_template(options=None)

Creates a Job Template

Parameters

options – Check options using hammer job-template create –help on satellite.

:returns JobTemplate object

robottelo.cli.factory.make_user(options=None)

Creates a User

Parameters

options – Check options using hammer user create –help on satellite.

:returns User object

robottelo.cli.factory.make_usergroup(options=None)

Creates a User Group

Parameters

options – Check options using hammer user-group create –help on satellite.

:returns UserGroup object

robottelo.cli.factory.make_usergroup_external(options=None)

Creates an External User Group

Parameters

options – Check options using hammer user-group external create –help on satellite.

:returns UserGroupExternal object

robottelo.cli.factory.make_ldap_auth_source(options=None)

Creates an LDAP Auth Source

Parameters

options – Check options using hammer auth-source ldap create –help on satellite.

:returns LDAPAuthSource object

robottelo.cli.factory.make_compute_resource(options=None)

Creates a Compute Resource

Parameters

options – Check options using hammer compute-resource create –help on satellite.

:returns ComputeResource object

robottelo.cli.factory.make_org(options=None)

Creates an Organization

Parameters

options – Check options using hammer organization create –help on satellite.

:returns Organization object

robottelo.cli.factory.make_org_with_credentials(options=None, credentials=None)

Helper function to create organization with credentials

robottelo.cli.factory.make_realm(options=None)

Creates a REALM

Parameters

options – Check options using hammer realm create –help on satellite.

:returns Realm object

robottelo.cli.factory.make_report_template(options=None)

Creates a Report Template

Parameters

options – Check options using hammer report-template create –help on satellite.

:returns ReportTemplate object

robottelo.cli.factory.make_os(options=None)

Creates an Operating System

Parameters

options – Check options using hammer os create –help on satellite.

:returns OperatingSys object

robottelo.cli.factory.make_scapcontent(options=None)

Creates Scap Content

Parameters

options – Check options using hammer scap-content create –help on satellite.

:returns ScapContent object

robottelo.cli.factory.make_domain(options=None)

Creates a Domain

Parameters

options – Check options using hammer domain create –help on satellite.

:returns Domain object

robottelo.cli.factory.make_hostgroup(options=None)

Creates a Hostgroup

Parameters

options – Check options using hammer hostgroup create –help on satellite.

:returns Hostgroup object

robottelo.cli.factory.make_medium(options=None)

Creates a Medium

Parameters

options – Check options using hammer medium create –help on satellite.

:returns Medium object

robottelo.cli.factory.make_environment(options=None)

Creates a Puppet Environment

Parameters

options – Check options using hammer environment create –help on satellite.

:returns Environment object

robottelo.cli.factory.make_lifecycle_environment(options=None)

Creates a Lifecycle Environment

Parameters

options – Check options using hammer lifecycle-environment create –help on satellite.

:returns LifecycleEnvironment object

robottelo.cli.factory.make_tailoringfile(options=None)

Creates a tailoring File

Parameters

options – Check options using hammer tailoring-file create –help on satellite.

:returns TailoringFile object

robottelo.cli.factory.make_template(options=None)

Creates a Template

Parameters

options – Check options using hammer template create –help on satellite.

:returns Template object

robottelo.cli.factory.make_template_input(options=None)

Creates Template Input

Parameters

options – Check options using hammer template-input create –help on satellite.

:returns TemplateInput object

robottelo.cli.factory.make_virt_who_config(options=None)

Creates a Virt Who Configuration

Parameters

options – Check options using hammer virt-who-config create –help on satellite.

:returns VirtWhoConfig object

robottelo.cli.factory.activationkey_add_subscription_to_repo(options=None)

Helper function that adds subscription to an activation key

robottelo.cli.factory.setup_org_for_a_custom_repo(options=None)

Sets up Org for the given custom repo by:

  1. Checks if organization and lifecycle environment were given, otherwise

    creates new ones.

  2. Creates a new product with the custom repo. Synchronizes the repo.

  3. Checks if content view was given, otherwise creates a new one and
    • adds the RH repo

    • publishes

    • promotes to the lifecycle environment

  4. Checks if activation key was given, otherwise creates a new one and

    associates it with the content view.

  5. Adds the custom repo subscription to the activation key

Returns

A dictionary with the entity ids of Activation key, Content view, Lifecycle Environment, Organization, Product and Repository

robottelo.cli.factory._setup_org_for_a_rh_repo(options=None)

Sets up Org for the given Red Hat repository by:

  1. Checks if organization and lifecycle environment were given, otherwise

    creates new ones.

  2. Clones and uploads manifest.

  3. Enables RH repo and synchronizes it.

  4. Checks if content view was given, otherwise creates a new one and
    • adds the RH repo

    • publishes

    • promotes to the lifecycle environment

  5. Checks if activation key was given, otherwise creates a new one and

    associates it with the content view.

  6. Adds the RH repo subscription to the activation key

Note that in most cases you should use setup_org_for_a_rh_repo instead as it’s more flexible.

Returns

A dictionary with the entity ids of Activation key, Content view, Lifecycle Environment, Organization and Repository

robottelo.cli.factory.setup_org_for_a_rh_repo(options=None, force_manifest_upload=False, force_use_cdn=False)

Wrapper above _setup_org_for_a_rh_repo to use custom downstream repo instead of CDN’s ‘Satellite Capsule’, ‘Satellite Tools’ and base OS repos if settings.cdn == 0 and URL for custom repositories is set in properties.

Parameters
  • options – a dict with options to pass to function _setup_org_for_a_rh_repo. See its docstring for more details

  • force_use_cdn – bool flag whether to use CDN even if there’s downstream repo available and settings.cdn == 0.

  • force_manifest_upload – bool flag whether to upload a manifest to organization even if downstream custom repo is used instead of CDN. Useful when test relies on organization with manifest (e.g. uses some other RH repo afterwards). Defaults to False.

Returns

a dict with entity ids (see _setup_org_for_a_rh_repo and setup_org_for_a_custom_repo).

robottelo.cli.factory.configure_env_for_provision(org=None, loc=None)

Create and configure org, loc, product, repo, env. Update proxy, domain, subnet, compute resource, provision templates and medium with previously created entities and create a hostgroup using all mentioned entities.

Parameters
  • org – Default Organization that should be used in both host discovering and host provisioning procedures

  • loc – Default Location that should be used in both host discovering and host provisioning procedures

Returns

List of created entities that can be re-used further in provisioning or validation procedure (e.g. hostgroup or subnet)

robottelo.cli.factory.publish_puppet_module(puppet_modules, repo_url, organization_id=None)

Creates puppet repo, sync it via provided url and publish using Content View publishing mechanism. It makes puppet class available via Puppet Environment created by Content View and returns Content View entity.

Parameters
  • puppet_modules – List of dictionaries with module ‘author’ and module ‘name’ fields.

  • repo_url (str) – Url of the repo that can be synced using pulp: pulp repo or puppet forge.

  • organization_id – Organization id that is shared between created entities.

Returns

Content View entity.

robottelo.cli.factory.setup_virtual_machine(vm, org_label, rh_repos_id=None, repos_label=None, product_label=None, lce=None, activation_key=None, patch_os_release_distro=None, install_katello_agent=True)

Setup a Virtual machine with basic components and tasks.

Parameters
  • vm (robottelo.vm.VirtualMachine) – The Virtual machine to setup.

  • org_label (str) – The Organization label.

  • rh_repos_id (list) – a list of RH repositories ids to enable.

  • repos_label (list) – a list of custom repositories labels to enable.

  • product_label (str) – product label if repos_label is applicable.

  • lce (str) – Lifecycle environment label if applicable.

  • activation_key (str) – Activation key name if applicable.

  • patch_os_release_distro (str) – distro name, to patch the VM with os version.

  • install_katello_agent (bool) – whether to install katello agent.

robottelo.cli.factory._get_capsule_vm_distro_repos(distro)

Return the right RH repos info for the capsule setup

robottelo.cli.factory.add_role_permissions(role_id, resource_permissions)

Create role permissions found in resource permissions dict

Parameters
  • role_id – The role id

  • resource_permissions – a dict containing resources with permission names and other Filter options

Usage:

role = make_role({'organization-id': org['id']})
resource_permissions = {
    'Katello::ActivationKey': {
        'permissions': [
            'view_activation_keys',
            'create_activation_keys',
            'edit_activation_keys',
            'destroy_activation_keys'
        ],
        'search': "name ~ {}".format(ak_name_like)
    },
}
add_role_permissions(role['id'], resource_permissions)
robottelo.cli.factory.setup_cdn_and_custom_repositories(org_id, repos, download_policy='on_demand', synchronize=True)

Setup cdn and custom repositories

Parameters
  • org_id (int) – The organization id

  • repos (list) – a list of dict repositories options

  • download_policy (str) – update the repositories with this download policy

  • synchronize (bool) – Whether to synchronize the repositories.

Returns

a dict containing the content view and repos info

robottelo.cli.factory.setup_cdn_and_custom_repos_content(org_id, lce_id=None, repos=None, upload_manifest=True, download_policy='on_demand', rh_subscriptions=None, default_cv=False)

Setup cdn and custom repositories, content view and activations key

Parameters
  • org_id (int) – The organization id

  • lce_id (int) – the lifecycle environment id

  • repos (list) – a list of dict repositories options

  • default_cv (bool) – whether to use the Default Organization CV

  • upload_manifest (bool) – whether to upload the organization manifest

  • download_policy (str) – update the repositories with this download policy

  • rh_subscriptions (list) – a list of RH subscription to attach to activation key

Returns

a dict containing the activation key, content view and repos info

robottelo.cli.factory.vm_setup_ssh_config(vm, ssh_key_name, host, user=None)

Create host entry in vm ssh config and know_hosts files to allow vm to access host via ssh without password prompt

Parameters
  • vm (robottelo.vm.VirtualMachine) – Virtual machine instance

  • ssh_key_name (str) – The ssh key file name to use to access host, the file must already exist in /root/.ssh directory

  • host (str) – the hostname to setup that will be accessed from vm

  • user (str) – the user that will access the host

robottelo.cli.factory.vm_upload_ssh_key(vm, source_key_path, destination_key_name)

Copy ssh key to virtual machine ssh path and ensure proper permission is set

Parameters
  • vm (robottelo.vm.VirtualMachine) – Virtual machine instance

  • source_key_path – The ssh key file path to copy to vm

  • destination_key_name – The ssh key file name when copied to vm

robottelo.cli.factory.virt_who_hypervisor_config(config_id, virt_who_vm, org_id=None, lce_id=None, hypervisor_hostname=None, configure_ssh=False, hypervisor_user=None, subscription_name=None, exec_one_shot=False, upload_manifest=True, extra_repos=None)

Configure virtual machine as hypervisor virt-who service

Parameters
  • config_id (int) – virt-who config id

  • virt_who_vm (robottelo.vm.VirtualMachine) – the Virtual machine instance to use for configuration

  • org_id (int) – the organization id

  • lce_id (int) – the lifecycle environment id to use

  • hypervisor_hostname (str) – the hypervisor hostname

  • hypervisor_user (str) – hypervisor user that connect with the ssh key

  • configure_ssh (bool) – whether to configure the ssh key to allow this virtual machine to connect to hypervisor

  • subscription_name (str) – the subscription name to assign to virt-who hypervisor guests

  • exec_one_shot (bool) – whether to run the virt-who one-shot command after startup

  • upload_manifest (bool) – whether to upload the organization manifest

  • extra_repos (list) – (Optional) a list of repositories dict options to setup additionally.

robottelo.cli.factory.make_http_proxy(options=None)

Creates a HTTP Proxy

Parameters

options – Check options using hammer http-proxy create –help on satellite.

:returns HttpProxy object

robottelo.cli.file

Usage:

hammer file [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

info                          Show a file
list                          List files
Module Contents
Classes

File

Manipulates files command.

class robottelo.cli.file.File

Bases: robottelo.cli.base.Base

Manipulates files command.

command_base = file
robottelo.cli.filter
Usage::

hammer filter [OPTIONS] SUBCOMMAND [ARG] …

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

available-permissions         List all permissions
available-resources           List available resource types.
create                        Create a filter
delete                        Delete a filter
info                          Show a filter
list                          List all filters
update                        Update a filter
Module Contents
Classes

Filter

Manipulates Katello’s filter command.

class robottelo.cli.filter.Filter

Bases: robottelo.cli.base.Base

Manipulates Katello’s filter command.

command_base = filter
classmethod available_permissions(cls, options=None)
robottelo.cli.globalparam

Usage:

hammer global-parameter [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

delete                        Delete a common_parameter
list                          List all common parameters.
set                           Set a global parameter.
Module Contents
Classes

GlobalParameter

Manipulates Foreman’s global parameters.

class robottelo.cli.globalparam.GlobalParameter

Bases: robottelo.cli.base.Base

Manipulates Foreman’s global parameters.

command_base = global-parameter
classmethod set(cls, options=None)

Set global parameter

robottelo.cli.gpgkey

Usage:

hammer gpg [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

create                        Create a GPG Key
delete                        Destroy a GPG Key
info                          Show a GPG key
list                          List GPG Keys
update                        Update a GPG Key
Module Contents
Classes

GPGKey

Manipulates Foreman’s GPG Keys.

class robottelo.cli.gpgkey.GPGKey

Bases: robottelo.cli.base.Base

Manipulates Foreman’s GPG Keys.

command_base = gpg
command_requires_org = True
classmethod info(cls, options=None)

Gets information for GPG Key

robottelo.cli.hammer

Helpers to interact with hammer command line utility.

Module Contents
Functions

_csv_reader(output)

An unicode CSV reader which processes unicode strings and return unicode

_normalize(header)

Replace empty spaces with ‘-’ and lower all chars

parse_json(stdout)

Parse JSON output from Hammer CLI and convert it to python dictionary

_normalize_obj(obj)

Normalize all dict’s keys replacing empty spaces with “-” and lowering

parse_csv(output)

Parse CSV output from Hammer CLI and convert it to python dictionary.

parse_help(output)

Parse the help output from a hammer command and return a dictionary

get_line_indentation_spaces(line, tab_spaces=4)

Return the number of spaces chars the line begin with

get_line_indentation_level(line, tab_spaces=4, indentation_spaces=4)

Return the indentation level

parse_info(output)

Parse the info output and returns a dict mapping the values.

robottelo.cli.hammer._csv_reader(output)[source]

An unicode CSV reader which processes unicode strings and return unicode strings data.

This is needed because the builtin module does not support unicode strings, from Python 2 docs:

Note: This version of the csv module doesn't support Unicode input.
Also, there are currently some issues regarding ASCII NUL characters.
Accordingly, all input should be UTF-8 or printable ASCII to be safe;"

On Python 3 this generator is not needed because the default string type is unicode.

Parameters

output – can be any object which supports the iterator protocol and returns a unicode string each time its next() method is called.

Returns

generator that will yield a list of unicode string values.

robottelo.cli.hammer._normalize(header)[source]

Replace empty spaces with ‘-’ and lower all chars

robottelo.cli.hammer.parse_json(stdout)[source]

Parse JSON output from Hammer CLI and convert it to python dictionary while normalizing keys.

robottelo.cli.hammer._normalize_obj(obj)[source]

Normalize all dict’s keys replacing empty spaces with “-” and lowering chars

robottelo.cli.hammer.parse_csv(output)[source]

Parse CSV output from Hammer CLI and convert it to python dictionary.

robottelo.cli.hammer.parse_help(output)[source]

Parse the help output from a hammer command and return a dictionary mapping the subcommands and options accepted by that command.

robottelo.cli.hammer.get_line_indentation_spaces(line, tab_spaces=4)[source]

Return the number of spaces chars the line begin with

Parameters
  • line (str) – the line string to parse

  • tab_spaces (int) – The tab char is represent how many spaces

robottelo.cli.hammer.get_line_indentation_level(line, tab_spaces=4, indentation_spaces=4)[source]

Return the indentation level

Parameters
  • line (str) – the line string to parse

  • tab_spaces (int) – The tab char is represent how many spaces

  • indentation_spaces – how much spaces represent an indentation level

Note:

suppose we have the following lines:
'''
level 0
    level 1
        level 2
'''
assert get_line_indentation_level('level 0') == 0
assert get_line_indentation_level('    level 1') == 1
assert get_line_indentation_level('        level 2') == 2
robottelo.cli.hammer.parse_info(output)[source]

Parse the info output and returns a dict mapping the values.

robottelo.cli.host
Usage::

hammer host [OPTIONS] SUBCOMMAND [ARG] …

Parameters::

SUBCOMMAND Subcommand [ARG] … Subcommand arguments

Subcommands::

ansible-roles Manage Ansible roles on a host boot Boot host from specified device config-reports List all reports create Create a host deb-package Manage deb packages on your hosts delete Delete a host delete-parameter Delete parameter for a host disassociate Disassociate a host enc-dump Dump host’s ENC YAML errata Manage errata on your hosts facts List all fact values info Show a host interface View and manage host’s network interfaces list List all hosts package Manage packages on your hosts package-group Manage package-groups on your hosts policies-enc View policies ENC for host puppet-classes List all Puppet classes reboot Reboot a host rebuild-config Rebuild orchestration related configurations for host reports List all reports reset Reset a host sc-params List all smart class parameters set-parameter Create or append a parameter for a host start Power a host on status Get status of host stop Power a host off subscription Manage subscription information on your hosts traces List traces on your hosts update Update a host

Module Contents
Classes

Host

Manipulates Foreman’s hosts.

HostInterface

Manages interface functionality for hosts.

class robottelo.cli.host.Host

Bases: robottelo.cli.base.Base

Manipulates Foreman’s hosts.

command_base = host
classmethod ansible_roles_play(cls, options)

Plays the associated ansible-roles

classmethod enc_dump(cls, options)

Dump host’s ENC YAML.

Usage:

hammer host enc-dump [OPTIONS]

Options:

--id ID
--location LOCATION_NAME                Location name
--location-id LOCATION_ID
--location-title LOCATION_TITLE         Location title
--name NAME                             Host name
--organization ORGANIZATION_NAME        Organization name
--organization-id ORGANIZATION_ID       Organization ID
--organization-title ORGANIZATION_TITLE Organization title
-h, --help                              Print help
classmethod errata_apply(cls, options)

Schedule errata for installation

classmethod errata_info(cls, options)

Retrieve a single errata for a system

classmethod errata_list(cls, options)

List errata available for the content host.

classmethod facts(cls, options=None)

List all fact values.

Usage:

hammer host facts [OPTIONS]

Options:

--id ID                       resource id
--name NAME                   resource name
--order ORDER                 sort results
--page PAGE                   paginate results
--per-page PER_PAGE           number of entries per request
--search SEARCH               filter results
-h, --help                    print help
classmethod package_install(cls, options)

Install packages remotely.

classmethod package_list(cls, options)

List packages installed on the host.

classmethod package_remove(cls, options)

Uninstall packages remotely.

classmethod package_upgrade(cls, options)

Update packages remotely.

classmethod package_upgrade_all(cls, options)

Update all packages remotely.

classmethod package_group_install(cls, options)

Install package groups remotely.

classmethod package_group_remove(cls, options)

Uninstall package groups remotely.

classmethod reboot(cls, options=None)

Reboot a host

Usage:

hammer host reboot [OPTIONS]

Options:

--id ID                       resource id
--name NAME                   resource name
-h, --help                    print help
classmethod reports(cls, options=None)

List all reports.

Usage:

hammer host reports [OPTIONS]

Options:

--id ID                       resource id
--name NAME                   resource name
--order ORDER                 sort results
--page PAGE                   paginate results
--per-page PER_PAGE           number of entries per request
--search SEARCH               filter results
-h, --help                    print help
classmethod start(cls, options=None)

Power a host on

Usage:

hammer host start [OPTIONS]

Options:

--id ID                       resource id
--name NAME                   resource name
-h, --help                    print help
classmethod status(cls, options=None)

Get status of host

Usage:

hammer host status [OPTIONS]

Options:

--id ID                       resource id
--name NAME                   resource name
-h, --help                    print help
classmethod stop(cls, options=None)

Power a host off

Usage:

hammer host stop [OPTIONS]

Options:

--force                       Force turning off a host
--id ID                       resource id
--name NAME                   resource name
-h, --help                    print help
classmethod subscription_register(cls, options=None)

Register a host with subscription and information.

Usage:

hammer host subscription register [OPTIONS]

Options:

--content-view CONTENT_VIEW_NAME                    Content view
                                                    name to search
                                                    by
--content-view-id CONTENT_VIEW_ID                   content view
                                                    numeric
                                                    identifier
--hypervisor-guest-uuids HYPERVISOR_GUEST_UUIDS     UUIDs of the
                                                    virtual guests
                                                    from the
                                                    host&#39;s
                                                    hypervisor
                                                    Comma separated
                                                    list of values.
--lifecycle-environment LIFECYCLE_ENVIRONMENT_NAME  Lifecycle
                                                    environment
                                                    name to search
                                                    by
--lifecycle-environment-id LIFECYCLE_ENVIRONMENT_ID  ID of the
                                                     environment
--name NAME                                         Name of the
                                                    host
--organization ORGANIZATION_NAME                    Organization
                                                    name to search
                                                    by
--organization-id ORGANIZATION_ID                   organization ID
--organization-label ORGANIZATION_LABEL             Organization
                                                    label to search
                                                    by
--release-version RELEASE_VERSION                   Release version
                                                    of the content
                                                    host
--service-level SERVICE_LEVEL                       A service level
                                                    for
                                                    auto-healing
                                                    process, e.g.
                                                    SELF-SUPPORT
--uuid UUID                                         UUID to use for
                                                    registered
                                                    host, random
                                                    uuid is
                                                    generated if
                                                    not provided
classmethod subscription_unregister(cls, options=None)

Unregister the host as a subscription consumer.

Usage:

hammer host subscription unregister [OPTIONS]

Options:

--host HOST_NAME              Name to search by
--host-id HOST_ID             Host ID
classmethod subscription_attach(cls, options=None)

Attach a subscription to host

Usage:

hammer host subscription attach [OPTIONS]

Options:

--host HOST_NAME                  Name to search by
--host-id HOST_ID                 Host ID
--quantity Quantity               Quantity of this subscriptions to
                                  add. Defaults to 1
--subscription-id SUBSCRIPTION_ID ID of subscription
classmethod subscription_remove(cls, options=None)

Remove a subscription from host

Usage:

hammer host subscription remove [OPTIONS]

Options:

--host HOST_NAME                    Name to search by
--host-id HOST_ID
--quantity Quantity                 Remove the first instance of a
                                    subscription with matching id
                                    and quantity
--subscription-id SUBSCRIPTION_ID   ID of subscription
classmethod subscription_auto_attach(cls, options=None)

Auto attach subscription to host

Usage:

hammer host subscription auto-attach [OPTIONS]

Options:

--host HOST_NAME              Name to search by
--host-id HOST_ID
-h, --help                    print help
classmethod sc_params(cls, options=None)

List all smart class parameters

Usage:

hammer host sc-params [OPTIONS]

Options:

--host HOST_NAME              Host name
--host-id HOST_ID
--order ORDER                 sort results
--page PAGE                   paginate results
--per-page PER_PAGE           number of entries per request
--search SEARCH               filter results
class robottelo.cli.host.HostInterface

Bases: robottelo.cli.base.Base

Manages interface functionality for hosts.

Usage::

hammer host interface [OPTIONS] SUBCOMMAND [ARG] …

Subcommands::

create Create an interface on a host delete Delete a host’s interface info Show an interface for host list List all interfaces for host update Update a host’s interface

command_base = host interface
classmethod create(cls, options=None)

Create new network interface for host

robottelo.cli.hostcollection

Usage:

hammer host-collection [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

add-host                      Add host to the host collection
copy                          Make copy of a host collection
create                        Create a host collection
delete                        Destroy a host collection
erratum                       Manipulate errata for a host collection
hosts                         List all hosts
info                          Show a host collection
list                          List host collections
package                       Manipulate packages for a host collection
package-group                 Manipulate package-groups for a host collection
remove-host                   Remove hosts from the host collection
update                        Update a host collection
Module Contents
Classes

HostCollection

Manipulates Katello engine’s host-collection command.

class robottelo.cli.hostcollection.HostCollection

Bases: robottelo.cli.base.Base

Manipulates Katello engine’s host-collection command.

command_base = host-collection
classmethod add_host(cls, options=None)

Add host to the host collection

classmethod remove_host(cls, options=None)

Remove hosts from the host collection

classmethod hosts(cls, options=None)

List hosts added to the host collection

Usage:

hammer host-collection hosts [OPTIONS]

Options:

--environment ENVIRONMENT_NAME          Name to search by
--environment-id ENVIRONMENT_ID
--hostgroup HOSTGROUP_NAME              Name to search by
--hostgroup-id HOSTGROUP_ID
--id HOST_COLLECTION_ID                 Host Collection ID
--location LOCATION_NAME                Name to search by
--location-id LOCATION_ID
--name HOST_COLLECTION_NAME             Host Collection Name
--order ORDER                           sort results
--organization ORGANIZATION_NAME        Organization name to
                                        search by
--organization-id ORGANIZATION_ID       organization ID
--organization-label ORGANIZATION_LABEL Organization label to
                                        search by
--page PAGE                             paginate results
--per-page PER_PAGE                     number of entries per
                                        request
--search SEARCH                         filter results
-h, --help                              print help
classmethod erratum_install(cls, options)

Schedule errata for installation

classmethod package_install(cls, options)

Schedule package for installation

classmethod copy(cls, options)

Clone existing host collection

robottelo.cli.hostgroup

Usage:

hammer hostgroup [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

ansible-roles                 Manage Ansible roles on a hostgroup
create                        Create a host group
delete                        Delete a host group
delete-parameter              Delete parameter for a hostgroup
info                          Show a host group
list                          List all host groups
puppet-classes                List all Puppet classes
rebuild-config                Rebuild orchestration config
sc-params                     List all smart class parameters
set-parameter                 Create or update parameter for a hostgroup
update                        Update a host group
Module Contents
Classes

HostGroup

Manipulates Foreman’s hostgroups.

class robottelo.cli.hostgroup.HostGroup

Bases: robottelo.cli.base.Base

Manipulates Foreman’s hostgroups.

command_base = hostgroup
classmethod sc_params(cls, options=None)

List all smart class parameters

Usage:

hammer hostgroup sc-params [OPTIONS]

Options:

--hostgroup HOSTGROUP_NAME        Hostgroup name
--hostgroup-id HOSTGROUP_ID
--hostgroup-title HOSTGROUP_TITLE Hostgroup title
--order ORDER                     sort results
--page PAGE                       paginate results
--per-page PER_PAGE               number of entries per request
--search SEARCH                   filter results
robottelo.cli.http_proxy
Usage:

http-proxy [OPTIONS] SUBCOMMAND [ARG] …

Parameters:

SUBCOMMAND Subcommand [ARG] … Subcommand arguments

Subcommands:

create Create an HTTP Proxy delete Delete an HTTP Proxy info Show an HTTP Proxy list List of HTTP Proxies update Update an HTTP Proxy

Options:
-h, --help

Print help

Module Contents
Classes

HttpProxy

Manipulates http-proxy command.

class robottelo.cli.http_proxy.HttpProxy

Bases: robottelo.cli.base.Base

Manipulates http-proxy command.

command_base = http-proxy
robottelo.cli.job_invocation
Usage:

hammer job-invocation [OPTIONS] SUBCOMMAND [ARG] …

Parameters:

SUBCOMMAND subcommand [ARG] … subcommand arguments

Subcommands:

create Create a job invocation info Show job invocation list List job invocations output View the output for a host

Module Contents
Classes

JobInvocation

Run remote jobs.

class robottelo.cli.job_invocation.JobInvocation

Bases: robottelo.cli.base.Base

Run remote jobs.

command_base = job-invocation
classmethod get_output(cls, options)

Get output of the job invocation

robottelo.cli.job_template
Usage:

hammer job-template [OPTIONS] SUBCOMMAND [ARG] …

Parameters:

SUBCOMMAND subcommand [ARG] … subcommand arguments

Subcommands:

create Create a job template delete Delete a job template dump View job template content info Show job template details list List job templates update Update a job template

Module Contents
Classes

JobTemplate

Manipulate job templates.

class robottelo.cli.job_template.JobTemplate

Bases: robottelo.cli.base.Base

Manipulate job templates.

command_base = job-template
robottelo.cli.ldapauthsource

Usage:

hammer auth-source ldap [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments
Subcommands::

create Create an LDAP authentication source delete Delete an LDAP authentication source info Show an LDAP authentication source list List all LDAP authentication sources update Update an LDAP authentication source

Module Contents
Classes

LDAPAuthSource

Manipulates LDAP auth source

ExternalAuthSource

Manipulates External auth source

class robottelo.cli.ldapauthsource.LDAPAuthSource

Bases: robottelo.cli.base.Base

Manipulates LDAP auth source

command_base = auth-source ldap
class robottelo.cli.ldapauthsource.ExternalAuthSource

Bases: robottelo.cli.base.Base

Manipulates External auth source

Usage:

hammer auth-source external [OPTIONS] SUBCOMMAND [ARG] …

Subcommands:

info Show an external user group for user group list List all external user groups for user group update Update external user group

command_base = auth-source external
robottelo.cli.lifecycleenvironment

Usage:

hammer lifecycle-environment [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

list                          List environments in an organization
update                        Update an environment
create                        Create an environment
delete                        Destroy an environment
info                          Show an environment
Module Contents
Classes

LifecycleEnvironment

Manipulates Katello engine’s lifecycle-environment command.

class robottelo.cli.lifecycleenvironment.LifecycleEnvironment

Bases: robottelo.cli.base.Base

Manipulates Katello engine’s lifecycle-environment command.

command_base = lifecycle-environment
command_requires_org = True
classmethod list(cls, options=None, per_page=False)

List information. @param options: ID (sometimes name works as well) to retrieve info.

classmethod paths(cls, options=None)
robottelo.cli.location

Usage:

hammer location [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

add-compute-resource          Associate a compute resource
add-domain                    Associate a domain
add-environment               Associate an environment
add-hostgroup                 Associate a hostgroup
add-medium                    Associate a medium
add-organization              Associate an organization
add-provisioning-template     Associate provisioning templates
add-smart-proxy               Associate a smart proxy
add-subnet                    Associate a subnet
add-user                      Associate an user
create                        Create a location
delete                        Delete a location
info                          Show a location
list                          List all locations
remove-compute-resource       Disassociate a compute resource
remove-domain                 Disassociate a domain
remove-environment            Disassociate an environment
remove-hostgroup              Disassociate a hostgroup
remove-medium                 Disassociate a medium
remove-organization           Disassociate an organization
remove-provisioning-template  Disassociate provisioning templates
remove-smart-proxy            Disassociate a smart proxy
remove-subnet                 Disassociate a subnet
remove-user                   Disassociate an user
update                        Update a location
Module Contents
Classes

Location

Manipulates Foreman’s Locations

class robottelo.cli.location.Location

Bases: robottelo.cli.base.Base

Manipulates Foreman’s Locations

command_base = location
classmethod add_compute_resource(cls, options=None)

Associate a compute resource

classmethod add_domain(cls, options=None)

Associate a domain

classmethod add_environment(cls, options=None)

Associate an environment

classmethod add_hostgroup(cls, options=None)

Associate a hostgroup

classmethod add_medium(cls, options=None)

Associate a medium

classmethod add_organization(cls, options=None)

Associate an organization

classmethod add_provisioning_template(cls, options=None)

Associate a provisioning template

classmethod add_smart_proxy(cls, options=None)

Associate a smart proxy

classmethod add_subnet(cls, options=None)

Associate a subnet

classmethod add_user(cls, options=None)

Associate a user

classmethod remove_compute_resource(cls, options=None)

Disassociate a compute resource

classmethod remove_domain(cls, options=None)

Disassociate a domain

classmethod remove_environment(cls, options=None)

Disassociate an environment

classmethod remove_hostgroup(cls, options=None)

Disassociate a hostgroup

classmethod remove_medium(cls, options=None)

Disassociate a medium

classmethod remove_organization(cls, options=None)

Disassociate an organization

classmethod remove_provisioning_template(cls, options=None)

Disassociate a provisioning template

classmethod remove_smart_proxy(cls, options=None)

Disassociate a smart proxy

classmethod remove_subnet(cls, options=None)

Disassociate a subnet

classmethod remove_user(cls, options=None)

Disassociate a user

robottelo.cli.medium

Usage:

hammer medium [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

add_operatingsystem           Associate a resource
create                        Create a medium.
delete                        Delete a medium.
info                          Show a medium.
list                          List all media.
remove_operatingsystem        Disassociate a resource
update                        Update a medium.
Module Contents
Classes

Medium

Manipulates Foreman’s installation media.

class robottelo.cli.medium.Medium

Bases: robottelo.cli.base.Base

Manipulates Foreman’s installation media.

command_base = medium
robottelo.cli.model

Usage:

hammer model [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

create                        Create a model.
delete                        Delete a model.
info                          Show a model.
list                          List all models.
update                        Update a model.
Module Contents
Classes

Model

Manipulates Foreman’s hardware model.

class robottelo.cli.model.Model

Bases: robottelo.cli.base.Base

Manipulates Foreman’s hardware model.

command_base = model
robottelo.cli.module_stream

Usage:

hammer module-stream [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

info                          Show a module-stream
list                          List module-streams
Module Contents
Classes

ModuleStream

Manipulates module-stream command.

class robottelo.cli.module_stream.ModuleStream

Bases: robottelo.cli.base.Base

Manipulates module-stream command.

command_base = module-stream
robottelo.cli.operatingsys

Usage:

hammer os [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

add-architecture              Associate a resource
add-provisioning-template     Associate provisioning templates
add-ptable                    Associate a resource
create                        Create an OS.
delete                        Delete an OS.
delete-default-template
delete-parameter              Delete parameter for an operating system.
info                          Show an OS.
list                          List all operating systems.
remove-architecture           Disassociate a resource
remove-provisioning-template  Disassociate provisioning templates
remove-ptable                 Disassociate a resource
set-default-template
set-parameter                 Create or update parameter for an
                              operating system.
update                        Update an OS.
Module Contents
Classes

OperatingSys

Manipulates Foreman’s operating systems.

class robottelo.cli.operatingsys.OperatingSys

Bases: robottelo.cli.base.Base

Manipulates Foreman’s operating systems.

command_base = os
classmethod add_architecture(cls, options=None)

Adds existing architecture to OS.

classmethod add_provisioning_template(cls, options=None)

Adds existing template to OS.

classmethod add_ptable(cls, options=None)

Adds existing partitioning table to OS.

classmethod remove_architecture(cls, options=None)

Removes architecture from OS.

classmethod remove_provisioning_template(cls, options=None)

Removes template from OS.

classmethod remove_ptable(cls, options=None)

Removes partitioning table from OS.

robottelo.cli.org

Usage:

hammer organization [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

add-computeresource           Associate a resource
add-domain                    Associate a resource
add-environment               Associate a resource
add-hostgroup                 Associate a resource
add-location                  Associate a location
add-medium                    Associate a resource
add-provisioning-template     Associate provisioning templates
add-smartproxy                Associate a resource
add-subnet                    Associate a resource
add-user                      Associate a resource
create                        Create an organization
delete                        Delete an organization
delete-parameter              Delete parameter for an organization.
info                          Show an organization
list                          List all organizations
remove_computeresource        Disassociate a resource
remove_domain                 Disassociate a resource
remove_environment            Disassociate a resource
remove_hostgroup              Disassociate a resource
remove-location               Disassociate a location
remove_medium                 Disassociate a resource
remove-provisioning-template  Disassociate provisioning templates
remove_smartproxy             Disassociate a resource
remove_subnet                 Disassociate a resource
remove_user                   Disassociate a resource
set-parameter                 Create or update parameter for an
                                organization.
update                        Update an organization
Module Contents
Classes

Org

Manipulates Foreman’s Organizations

class robottelo.cli.org.Org

Bases: robottelo.cli.base.Base

Manipulates Foreman’s Organizations

command_base = organization
classmethod add_compute_resource(cls, options=None)

Adds a computeresource to an org

classmethod remove_compute_resource(cls, options=None)

Removes a computeresource from an org

classmethod add_domain(cls, options=None)

Adds a domain to an org

classmethod remove_domain(cls, options=None)

Removes a domain from an org

classmethod add_environment(cls, options=None)

Adds an environment to an org

classmethod remove_environment(cls, options=None)

Removes an environment from an org

classmethod add_hostgroup(cls, options=None)

Adds a hostgroup to an org

classmethod remove_hostgroup(cls, options=None)

Removes a hostgroup from an org

classmethod add_location(cls, options=None)

Adds a location to an org

classmethod remove_location(cls, options=None)

Removes a location from an org

classmethod add_medium(cls, options=None)

Adds a medium to an org

classmethod remove_medium(cls, options=None)

Removes a medium from an org

classmethod add_provisioning_template(cls, options=None)

Adds a provisioning template to an org

classmethod remove_provisioning_template(cls, options=None)

Removes a provisioning template from an org

classmethod add_smart_proxy(cls, options=None)

Adds a smartproxy to an org

classmethod remove_smart_proxy(cls, options=None)

Removes a smartproxy from an org

classmethod add_subnet(cls, options=None)

Adds existing subnet to an org

classmethod remove_subnet(cls, options=None)

Removes a subnet from an org

classmethod add_user(cls, options=None)

Adds an user to an org

classmethod remove_user(cls, options=None)

Removes an user from an org

robottelo.cli.ostreebranch

Usage:

hammer ostree-branch [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

info                          Show an ostree branch
list                          List ostree_branches
Module Contents
Classes

OstreeBranch

Manipulates Ostree branches.

class robottelo.cli.ostreebranch.OstreeBranch

Bases: robottelo.cli.base.Base

Manipulates Ostree branches.

command_base = ostree-branch
robottelo.cli.package

Usage:

hammer package [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

info                          Show a package
list                          List packages
Module Contents
Classes

Package

Manipulates packages command.

class robottelo.cli.package.Package

Bases: robottelo.cli.base.Base

Manipulates packages command.

command_base = package
robottelo.cli.partitiontable

Usage:

hammer partition-table [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

add_operatingsystem           Associate a resource
create                        Create a ptable.
delete                        Delete a ptable.
dump                          View partition table content.
info                          Show a ptable.
list                          List all ptables.
remove_operatingsystem        Disassociate a resource
update                        Update a ptable.
Module Contents
Classes

PartitionTable

Manipulates Foreman’s partition tables.

class robottelo.cli.partitiontable.PartitionTable

Bases: robottelo.cli.base.Base

Manipulates Foreman’s partition tables.

command_base = partition-table
robottelo.cli.product

Usage:

hammer product [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

create                        Create a product
delete                        Destroy a product
info                          Show a product
list                          List products in an environment
remove_sync_plan              Delete assignment sync plan and product.
set_sync_plan                 Assign sync plan to product.
synchronize                   Sync a repository
update                        Update a product
update-proxy                  Updates an HTTP Proxy for a product
Module Contents
Classes

Product

Manipulates Katello engine’s product command.

class robottelo.cli.product.Product

Bases: robottelo.cli.base.Base

Manipulates Katello engine’s product command.

command_base = product
command_requires_org = True
classmethod remove_sync_plan(cls, options=None)

Delete assignment sync plan and product.

classmethod set_sync_plan(cls, options=None)

Assign sync plan to product.

classmethod synchronize(cls, options=None)

Synchronize a product.

classmethod update_proxy(cls, options=None)

Assign Http Proxy to products.

robottelo.cli.proxy

Usage:

hammer proxy [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

create                        Create a smart proxy.
delete                        Delete a smart_proxy.
import_classes                Import puppet classes from puppet proxy.
info                          Show a smart proxy.
list                          List all smart_proxies.
refresh-features              Refresh smart proxy features
update                        Update a smart proxy.
Module Contents
Classes

Proxy

Manipulates Foreman’s smart proxies.

exception robottelo.cli.proxy.CapsuleTunnelError

Bases: Exception

Raised when tunnel creation fails.

class robottelo.cli.proxy.Proxy

Bases: robottelo.cli.base.Base

Manipulates Foreman’s smart proxies.

command_base = proxy
classmethod import_classes(cls, options=None)

Import puppet classes from puppet proxy.

classmethod refresh_features(cls, options=None)

Refreshes smart proxy features

robottelo.cli.puppet

Usage:

hammer puppet-class [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

info                          Show a puppetclass
list                          List all puppetclasses.
sc-params                     List all smart class parameters
Module Contents
Classes

Puppet

Search Foreman’s puppet modules.

class robottelo.cli.puppet.Puppet

Bases: robottelo.cli.base.Base

Search Foreman’s puppet modules.

command_base = puppet-class
classmethod sc_params(cls, options=None)
Usage:

hammer puppet-class sc-params [OPTIONS]

Options:
--order ORDER

sort results

--page PAGE

paginate results

--per-page PER_PAGE

number of entries per request

--puppet-class PUPPET_CLASS_NAME

Puppet class name

--puppet-class-id PUPPET_CLASS_ID

ID of Puppet class

--search SEARCH

filter results

robottelo.cli.puppetmodule

Usage:

hammer puppet-module [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

info                          Show a puppet module
list                          List puppet modules
Module Contents
Classes

PuppetModule

To list OR show puppet modules.

class robottelo.cli.puppetmodule.PuppetModule

Bases: robottelo.cli.base.Base

To list OR show puppet modules.

command_base = puppet-module
robottelo.cli.realm
Usage:

hammer realm [OPTIONS] SUBCOMMAND [ARG] …

Parameters:

SUBCOMMAND subcommand [ARG] … subcommand arguments

Subcommands:

create Create a realm delete Delete a realm info Show a realm list List of realms update Update a realm

Options:
-h, --help

print help

Module Contents
Classes

Realm

Manipulates Realm subcommand

class robottelo.cli.realm.Realm

Bases: robottelo.cli.base.Base

Manipulates Realm subcommand

command_base = realm
robottelo.cli.recurring_logic
Usage:

hammer recurring-logic [OPTIONS] SUBCOMMAND [ARG] …

Parameters:

SUBCOMMAND subcommand [ARG] … subcommand arguments

Subcommands:

cancel Cancel recurring logic info Show recurring logic details list List recurring logics

Module Contents
Classes

RecurringLogic

Manipulate recurring logics

class robottelo.cli.recurring_logic.RecurringLogic

Bases: robottelo.cli.base.Base

Manipulate recurring logics

command_base = recurring-logic
robottelo.cli.report

Usage:

hammer report [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

delete                        Delete report.
info                          Show info for report.
list                          List reports.
Module Contents
Classes

Report

Manipulates Foreman’s reports.

class robottelo.cli.report.Report

Bases: robottelo.cli.base.Base

Manipulates Foreman’s reports.

command_base = report
robottelo.cli.report_template

Usage:

hammer report-template [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    Subcommand
[ARG] ...                     Subcommand arguments

Subcommands:

clone                         Clone a template
create                        Create a report template
delete                        Delete a report template
dump                          View report content
generate                      Generate report
info                          Show a report template
list                          List all report templates
report-data                   Downloads a generated report
schedule                      Schedule generating of a report
update                        Update a report template
Module Contents
Classes

ReportTemplate

Manipulates with Report Template

class robottelo.cli.report_template.ReportTemplate

Bases: robottelo.cli.base.Base

Manipulates with Report Template

command_base = report-template
classmethod create(cls, options=None)

Creates a new record using the arguments passed via dictionary.

classmethod generate(cls, options=None)

Generate a report

classmethod clone(cls, options=None)

Clone a report template

classmethod report_data(cls, options=None)

Downloads a generated report

classmethod schedule(cls, options=None)

Schedule generating of a report

robottelo.cli.repository

Usage:

hammer repository [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

create                        Create a repository
delete                        Destroy a repository
export                        Export a repository
info                          Show a repository
list                          List of repositories
remove-content                Remove content from the repository
synchronize                   Sync a repository
update                        Update a repository
upload-content                Upload content into the repository
Module Contents
Classes

Repository

Manipulates Katello engine’s repository command.

class robottelo.cli.repository.Repository

Bases: robottelo.cli.base.Base

Manipulates Katello engine’s repository command.

command_base = repository
command_requires_org = True
classmethod create(cls, options=None)

Create a custom repository

classmethod export(cls, options=None)

Export a repository

classmethod info(cls, options=None)

Show a custom repository

classmethod synchronize(cls, options, return_raw_response=None, timeout=3600)

Synchronizes a repository.

classmethod remove_content(cls, options)

Remove content from a repository

classmethod upload_content(cls, options)

Upload content to repository.

robottelo.cli.repository_set

Implementing the repository-set hammer command

Usage:

hammer repository-set [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

available-repositories        Get list or available repositories for
                              the repository set
disable                       Disable a repository
enable                        Enable a repository
info                          Show a repository
list                          List of repositories
Module Contents
Classes

RepositorySet

Manipulates Katello engine’s repository command.

class robottelo.cli.repository_set.RepositorySet

Bases: robottelo.cli.base.Base

Manipulates Katello engine’s repository command.

command_base = repository-set
classmethod enable(cls, options)

Enables a repository.

classmethod disable(cls, options)

Disables a repository.

classmethod available_repositories(cls, options)

Lists the available repositories.

hammer repository-set available-repositories –help

Usage:

hammer repository-set available-repositories [OPTIONS]

Options:

--id ID                                 ID of the repository set
--name NAME                             Repository set
                                        name to search by
--organization ORGANIZATION_NAME        Organization
                                        name to search by
--organization-id ORGANIZATION_ID       organization ID
--organization-label ORGANIZATION_LABEL Organization label
                                        to search by
--product PRODUCT_NAME                  Product name
                                        to search by
--product-id PRODUCT_ID                 product numeric identifier
-h, --help                              print help
robottelo.cli.role

Usage:

hammer role [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

clone                         Clone a role
create                        Create an role.
delete                        Delete an role.
filters                       List all filters.
info                          Show a role
list                          List all roles.
update                        Update an role.
Module Contents
Classes

Role

Manipulates Katello engine’s role command.

class robottelo.cli.role.Role

Bases: robottelo.cli.base.Base

Manipulates Katello engine’s role command.

command_base = role
classmethod filters(cls, options=None)

List all filters

classmethod clone(cls, options)

Clone a role

robottelo.cli.scap_policy

Usage:

policy [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

create                        Create a Policy
delete                        Delete a Policy
info                          Show a Policy
list                          List Policies
update                        Update a Policy
Module Contents
Classes

Scappolicy

Manipulates Satellite’s oscap policy.

class robottelo.cli.scap_policy.Scappolicy

Bases: robottelo.cli.base.Base

Manipulates Satellite’s oscap policy.

command_base = policy
robottelo.cli.scap_tailoring_files

Usage:

tailoring-file [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

create                        Create a Tailoring file
delete                        Deletes a Tailoring file
download                      Show a Tailoring file as XML
info                          Show a Tailoring file
list                          List Tailoring files
update                        Update a Tailoring file
Module Contents
Classes

TailoringFiles

Manipulates Satellite’s tailoring-file.

class robottelo.cli.scap_tailoring_files.TailoringFiles

Bases: robottelo.cli.base.Base

Manipulates Satellite’s tailoring-file.

command_base = tailoring-file
classmethod download_tailoring_file(cls, options)

Downloads the tailoring file from satellite

robottelo.cli.scapcontent

Usage:

scap-content [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

create                        Create SCAP content
delete                        Deletes an SCAP content
info                          Show an SCAP content
list                          List SCAP contents
update                        Update an SCAP content
Module Contents
Classes

Scapcontent

Manipulates Satellite’s scap-content.

class robottelo.cli.scapcontent.Scapcontent

Bases: robottelo.cli.base.Base

Manipulates Satellite’s scap-content.

command_base = scap-content
robottelo.cli.scparams

Usage:

hammer sc-param [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

add-override-value            Create an override value for a specific smart
                              variable
info                          Show a smart class parameter
list                          List all smart class parameters
remove-override-value         Delete an override value for a specific smart
                              variable
update                        Update a smart class parameter
Module Contents
Classes

SmartClassParameter

Manipulates smart class parameters

class robottelo.cli.scparams.SmartClassParameter

Bases: robottelo.cli.base.Base

Manipulates smart class parameters

command_base = sc-param
classmethod info(cls, options=None)

Gets information for smart class parameter

classmethod add_matcher(cls, options=None)

Create a matcher for a specific smart class parameter

Usage:

hammer sc-param add-matcher [OPTIONS]

Options:

--location[-id|-title]        Name/Title/Id of associated location
--match MATCH                 Override match
--omit OMIT                   Satellite will not send this parameter in
                              classificationoutput
                              One of true/false, yes/no, 1/0.
--organization[-id|-title]    Name/Title/Id of associated organization
--puppet-class[-id]           Name/Id of associated puppetclass
--smart-class-parameter[-id]  Name/Id of associated smart class parameter
--value VALUE                 Override value, required if omit is false
classmethod remove_matcher(cls, options=None)

Delete a matcher for a specific smart class parameter

Usage:

hammer sc-param remove-matcher [OPTIONS]

Options:

--id ID
--location[-id|-title]        Name/Title/Id of associated location
--organization[-id|-title]    Name/Title/Id of associated organization
--puppet-class[-id]           Name/Id of associated puppetclass
--smart-class-parameter[-id]  Name/Id of associated smart class parameter
robottelo.cli.settings

Usage:

hammer settings [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

list                          List all settings
set                           Update a setting
Module Contents
Classes

Settings

Manipulates Foreman’s settings.

class robottelo.cli.settings.Settings

Bases: robottelo.cli.base.Base

Manipulates Foreman’s settings.

command_base = settings
classmethod set(cls, options=None)

Update a setting

robottelo.cli.srpm
Usage:

hammer srpm [OPTIONS] SUBCOMMAND [ARG] …

Parameters:

SUBCOMMAND Subcommand [ARG] … Subcommand arguments

Subcommands:

info Show a SRPM Details list List srpms

Module Contents
Classes

Srpm

Manipulates Katello engine’s srpm command.

class robottelo.cli.srpm.Srpm

Bases: robottelo.cli.base.Base

Manipulates Katello engine’s srpm command.

command_base = srpm
classmethod info(cls, options=None)

Show a SRPM Info

classmethod list(cls, options=None)

List SRPMs

robottelo.cli.subnet

Usage:

hammer subnet [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

create                        Create a subnet
delete                        Delete a subnet
info                          Show a subnet.
list                          List of subnets
update                        Update a subnet
Module Contents
Classes

Subnet

Manipulates Foreman’s subnets.

class robottelo.cli.subnet.Subnet

Bases: robottelo.cli.base.Base

Manipulates Foreman’s subnets.

command_base = subnet
robottelo.cli.subscription

Usage:

hammer sunscription [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

delete-manifest               Delete manifest from Red Hat provider
list                          List organization subscriptions
manifest-history              obtain manifest history for subscriptions
refresh-manifest              Refresh previously imported manifest for
                              Red Hat provider
upload                        Upload a subscription manifest
Module Contents
Classes

Subscription

Manipulates Katello engine’s subscription command.

class robottelo.cli.subscription.Subscription

Bases: robottelo.cli.base.Base

Manipulates Katello engine’s subscription command.

command_base = subscription
classmethod upload(cls, options=None, timeout=None)

Upload a subscription manifest.

classmethod delete_manifest(cls, options=None, timeout=None)

Deletes a subscription manifest.

classmethod refresh_manifest(cls, options=None, timeout=None)

Refreshes a subscription manifest.

classmethod manifest_history(cls, options=None)

Provided history for subscription manifest

robottelo.cli.syncplan

Usage:

hammer sync-plan [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

create                        Create a sync plan
delete                        Destroy a sync plan
info                          Show a sync plan
list                          List sync plans
update
Module Contents
Classes

SyncPlan

Manipulates Katello engine’s sync-plan command.

class robottelo.cli.syncplan.SyncPlan

Bases: robottelo.cli.base.Base

Manipulates Katello engine’s sync-plan command.

command_base = sync-plan
robottelo.cli.task

Usage:

hammer task [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

list                          List tasks
progress                      Show the progress of the task
resume                        Resume all tasks paused in error state
Module Contents
Classes

Task

Manipulates Foreman’s task.

class robottelo.cli.task.Task

Bases: robottelo.cli.base.Base

Manipulates Foreman’s task.

command_base = task
classmethod progress(cls, options=None, return_raw_response=None)

Shows a task progress

Usage::

hammer task progress [OPTIONS]

Options::
--id ID

UUID of the task

--name NAME

Name to search by

classmethod resume(cls, options=None)

Resumes a task

Usage:

hammer task resume [OPTIONS]

Options:
--search SEARCH

Resume tasks matching search string

--task-ids TASK_IDS

Comma separated list of values.

--tasks TASK_NAMES

Comma separated list of values.

classmethod list_tasks(cls, options=None)

List tasks

Usage:

hammer task list [OPTIONS]

Options:
--search SEARCH

List tasks matching search string

robottelo.cli.template
Usage::

hammer template [OPTIONS] SUBCOMMAND [ARG] …

Parameters::

SUBCOMMAND Subcommand [ARG] … Subcommand arguments

Subcommands::

add-operatingsystem Associate an operating system build-pxe-default Update the default PXE menu on all configured TFTP servers clone Clone a provision template combination Manage template combinations create Create a provisioning template delete Delete a provisioning template dump View provisioning template content info Show provisioning template details kinds List available provisioning template kinds list List provisioning templates remove-operatingsystem Disassociate an operating system update Update a provisioning template

Module Contents
Classes

Template

Manipulates Foreman’s configuration templates.

class robottelo.cli.template.Template

Bases: robottelo.cli.base.Base

Manipulates Foreman’s configuration templates.

command_base = template
classmethod kinds(cls, options=None)

Returns list of types of templates.

classmethod add_operatingsystem(cls, options=None)

Adds operating system, requires “id” and “operatingsystem-id”.

classmethod remove_operatingsystem(cls, options=None)

Remove operating system, requires “id” and “operatingsystem-id”.

classmethod clone(cls, options=None)

Clone provided provisioning template

classmethod build_pxe_default(cls, options=None)

Build PXE default template

robottelo.cli.template_input

Usage:

hammer template-input [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    Subcommand
[ARG] ...                     Subcommand arguments

Subcommands:

create                        Create a template input
delete                        Delete a template input
info                          Show template input details
list                          List template inputs
Module Contents
Classes

TemplateInput

Manipulates template input.

class robottelo.cli.template_input.TemplateInput

Bases: robottelo.cli.base.Base

Manipulates template input.

command_base = template-input
classmethod create(cls, options=None)

Creates a new record using the arguments passed via dictionary.

robottelo.cli.template_sync

Export

Usage::

hammer export-templates [OPTIONS]

Options::

branch Branch in Git repo. commit-msg Custom commit message for templates export dirname The directory within Git repo containing the templates filter Export templates with names matching this regex ( case-insensitive; snippets are not filtered). location[-id|-title] Name/Title/Id of associated location location[s|-ids|-titles] REPLACE locations with given Names/Titles/Ids metadata-export-mode Specify how to handle metadata negate Negate the prefix (for purging). organization[-id|-title] Name/Title/Id of associated organization organization[s|-ids|-titles] REPLACE organizations with given Names/Titles/Ids. repo Override the default repo from settings.

Import

Usage::

hammer import-templates [OPTIONS]

Options::

associate Associate to OS’s, Locations & Organizations. Options are: always branch Branch in Git repo. dirname The directory within Git repo containing the templates filter Export templates with names matching this regex force Update templates that are locked location[-id|-title] Name/Title/Id of associated location location[s|-ids|-titles] REPLACE locations with given Names/Titles/Ids lock Lock imported templates negate Negate the prefix (for purging). organization[-id|-title] Name/Title/Id of associated organization organization[s|-ids|-titles] REPLACE organizations with given Names/Titles/Ids. prefix The string all imported templates should begin with. repo Override the default repo from settings.

Module Contents
Classes

TemplateSync

Export/Import Satellite Templates to Git/Local Directory.

class robottelo.cli.template_sync.TemplateSync

Bases: robottelo.cli.base.Base

Export/Import Satellite Templates to Git/Local Directory.

classmethod exports(cls, options=None)

Export Satellite Templates to Git/Local Directory.

classmethod imports(cls, options=None)

Import Satellite Templates to Git/Local Directory.

robottelo.cli.user

Usage:

hammer user [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

add-role                      Assign a user role
create                        Create an user.
delete                        Delete an user.
info                          Show an user.
list                          List all users.
remove-role                   Remove a user role
ssh-keys                      Managing User SSH Keys.
update                        Update an user.
Module Contents
Classes

User

Manipulates Foreman’s users.

class robottelo.cli.user.User

Bases: robottelo.cli.base.Base

Manipulates Foreman’s users.

command_base = user
classmethod add_role(cls, options=None)

Add a role to a user.

classmethod remove_role(cls, options=None)

Remove a role from user.

classmethod ssh_keys_add(cls, options=None)

Usage: hammer user ssh-keys add [OPTIONS]

Options: –key KEY Public SSH key –key-file KEY_FILE Path to a SSH public key –location LOCATION_NAME Location name –location-id LOCATION_ID –location-title LOCATION_TITLE Location title –name NAME –organization ORGANIZATION_NAME Organization name –organization-id ORGANIZATION_ID Organization ID –organization-title ORGANIZATION_TITLE Organization title –user USER_LOGIN User’s login to search by –user-id USER_ID

classmethod ssh_keys_delete(cls, options=None)

Usage: hammer user ssh-keys delete [OPTIONS]

classmethod ssh_keys_list(cls, options=None)

Usage: hammer user ssh-keys list [OPTIONS]

classmethod ssh_keys_info(cls, options=None)

Usage: hammer user ssh-keys info [OPTIONS]

robottelo.cli.usergroup
Usage::

hammer user-group [OPTIONS] SUBCOMMAND [ARG] …

Parameters::

SUBCOMMAND subcommand [ARG] … subcommand arguments

Subcommands::

add-role Assign a user role add-user Associate an user add-user-group Associate an user group create Create a user group delete Delete a user group external View and manage external user groups info Show a user group list List all user groups remove-role Remove a user role remove-user Disassociate an user remove-user-group Disassociate an user group update Update a user group

Module Contents
Classes

UserGroup

Manipulates Foreman’s user group.

UserGroupExternal

Manages Foreman external user groups.

class robottelo.cli.usergroup.UserGroup

Bases: robottelo.cli.base.Base

Manipulates Foreman’s user group.

command_base = user-group
classmethod add_role(cls, options=None)

Assign a user role.

Usage:

hammer user-group add-role [OPTIONS]

Options:

–id ID –name NAME Name to search by –role ROLE_NAME User role name –role-id ROLE_ID

classmethod add_user(cls, options=None)

Associate an user.

Usage:

hammer user-group add-user [OPTIONS]

Options:

–id ID –name NAME Name to search by –user USER_LOGIN User’s login to search by –user-id USER_ID

classmethod add_user_group(cls, options=None)

Associate an user group.

Usage:

hammer user-group add-user-group [OPTIONS]

Options:

–id ID –name NAME Name to search by –user-group USER_GROUP_NAME Name to search by –user-group-id USER_GROUP_ID

classmethod remove_role(cls, options=None)

Remove a user role.

Usage:

hammer user-group remove-role [OPTIONS]

Options:

–id ID –name NAME Name to search by –role ROLE_NAME User role name –role-id ROLE_ID

classmethod remove_user(cls, options=None)

Disassociate an user.

Usage:

hammer user-group remove-user [OPTIONS]

Options:

–id ID –name NAME Name to search by –user USER_LOGIN User’s login to search by –user-id USER_ID

classmethod remove_user_group(cls, options=None)

Disassociate an user group.

Usage:

hammer user-group remove-user-group [OPTIONS]

Options:

–id ID –name NAME Name to search by –user-group USER_GROUP_NAME Name to search by –user-group-id USER_GROUP_ID

class robottelo.cli.usergroup.UserGroupExternal

Bases: robottelo.cli.base.Base

Manages Foreman external user groups.

Usage:

hammer user-group external [OPTIONS] SUBCOMMAND [ARG] …

Subcommands:

create Create an external user group linked to a user group delete Delete an external user group info Show an external user group for user group list List all external user groups for user group refresh Refresh external user group update Update external user group

command_base = user-group external
classmethod refresh(cls, options=None)
classmethod create(cls, options=None)

Create external user group

robottelo.cli.virt_who_config
Usage:

hammer virt-who-config [OPTIONS] SUBCOMMAND [ARG] …

Parameters:

SUBCOMMAND                    subcommand
[ARG] ...                     subcommand arguments

Subcommands:

create                        Create a virt-who configuration
delete                        Delete a virt-who configuration
deploy                        Download and execute script for the specified
                            virt-who configuration
fetch                         Renders a deploy script for the specified
                            virt-who configuration
info                          Show a virt-who configuration
list                          List of virt-who configurations
update                        Update a virt-who configuration
Module Contents
Classes

VirtWhoConfig

Manipulates virt-who configuration.

class robottelo.cli.virt_who_config.VirtWhoConfig

Bases: robottelo.cli.base.Base

Manipulates virt-who configuration.

command_base = virt-who-config
classmethod fetch(cls, options=None, output_format=None)

Renders a deploy script for the specified virt-who configuration

classmethod deploy(cls, options=None)

runs hammer virt-who-config deploy –id <x> which runs the script on the satellite server

Parameters

optionsid required

Returns

Results of the command

robottelo.config
Submodules
robottelo.config.base

Define and instantiate the configuration class for Robottelo.

Module Contents
Classes

INIReader

ConfigParser wrapper able to cast value when reading INI options.

FeatureSettings

Settings related to a feature.

ServerSettings

Satellite server settings definitions.

BrokerSettings

Broker settings definitions.

BugzillaSettings

Bugzilla server settings definitions.

CapsuleSettings

Clients settings definitions.

CertsSettings

Katello-certs settings definitions.

ClientsSettings

Clients settings definitions.

ContainerRepositorySettings

Settings for syncing containers from container registries

DistroSettings

Distro settings definitions.

DockerSettings

Docker settings definitions.

AzureRMSettings

Azure Resource Manager settings definitions.

EC2Settings

AWS EC2 settings definitions.

FakeManifestSettings

Fake manifest settings defintitions.

GCESettings

Google Compute Engine settings definitions.

RHSSOSettings

RHSSO settings definitions.

LDAPSettings

LDAP settings definitions.

LDAPIPASettings

LDAP freeIPA settings definitions.

OpenLDAPSettings

Open LDAP settings definitions.

LibvirtHostSettings

Libvirt host settings definitions.

FakeCapsuleSettings

Fake Capsule settings definitions.

RHEVSettings

RHEV settings definitions.

VmWareSettings

VmWare settings definitions.

DiscoveryISOSettings

Discovery ISO name settings definition.

OscapSettings

Oscap settings definitions.

OSPSettings

OSP settings definitions.

PerformanceSettings

Performance settings definitions.

SSHClientSettings

SSHClient settings definitions.

VlanNetworkSettings

Vlan Network settings definitions.

UpgradeSettings

Satellite upgrade settings definitions.

SharedFunctionSettings

Shared function settings definitions.

VirtWhoSettings

VirtWho settings definitions.

ReportPortalSettings

Report portal settings definitions.

Settings

Robottelo’s settings representation.

HttpProxySettings

Http Proxy settings definitions.

Functions

get_project_root()

Return the path to the Robottelo project root directory.

Attributes

LOGGER

SETTINGS_FILE_NAME

robottelo.config.base.LOGGER
robottelo.config.base.SETTINGS_FILE_NAME = robottelo.properties
exception robottelo.config.base.ImproperlyConfigured

Bases: Exception

Indicates that Robottelo somehow is improperly configured.

For example, if settings file can not be found or some required configuration is not defined.

robottelo.config.base.get_project_root()

Return the path to the Robottelo project root directory.

Returns

A directory path.

Return type

str

class robottelo.config.base.INIReader(path)

ConfigParser wrapper able to cast value when reading INI options.

cast_boolean
cast_dict
cast_list
cast_logging_level
cast_tuple
cast_webdriver_desired_capabilities
get(self, section, option, default=None, cast=None)

Read an option from a section of a INI file.

First try to lookup for the value as an environment variable having the following format: ROBOTTELO_{SECTION}_{OPTION}.

The default value will return if the look up option is not available. The value will be cast using a callable if specified otherwise a string will be returned.

Parameters
  • section – Section to look for.

  • option – Option to look for.

  • default – The value that should be used if the option is not defined.

  • cast – If provided the value will be cast using the cast provided.

has_section(self, section)

Check if section is available.

class robottelo.config.base.FeatureSettings

Settings related to a feature.

Create a instance of this class and assign attributes to map to the feature options.

abstract read(self, reader)

Subclasses must implement this method in order to populate itself with expected settings values.

Parameters

reader – An INIReader instance to read the settings.

abstract validate(self)

Subclasses must implement this method in order to validade the settings and raise ImproperlyConfigured if any issue is found.

class robottelo.config.base.ServerSettings(*args, **kwargs)

Bases: FeatureSettings

Satellite server settings definitions.

read(self, reader)

Read and validate Satellite server settings.

property version(self)
validate(self)

Subclasses must implement this method in order to validade the settings and raise ImproperlyConfigured if any issue is found.

get_credentials(self)

Return credentials for interacting with a Foreman deployment API.

Returns

A username-password pair.

Return type

tuple

get_hostname(self, key='hostname')
get_url(self)

Return the base URL of the Foreman deployment being tested.

The following values from the config file are used to build the URL:

  • [server] scheme (default: https)

  • [server] hostname (required)

  • [server] port (default: none)

Setting port to 80 does not imply that scheme is ‘https’. If port is 80 and scheme is unset, scheme will still default to ‘https’.

Returns

A URL.

Return type

str

get_pub_url(self)

Return the pub URL of the server being tested.

The following values from the config file are used to build the URL:

  • main.server.hostname (required)

Returns

The pub directory URL.

Return type

str

get_cert_rpm_url(self)

Return the Katello cert RPM URL of the server being tested.

The following values from the config file are used to build the URL:

  • main.server.hostname (required)

Returns

The Katello cert RPM URL.

Return type

str

class robottelo.config.base.BrokerSettings(*args, **kwargs)

Bases: FeatureSettings

Broker settings definitions.

read(self, reader)

Read and validate broker settings.

validate(self)

This section is lazily validated on .issue_handlers.bugzilla.

class robottelo.config.base.BugzillaSettings(*args, **kwargs)

Bases: FeatureSettings

Bugzilla server settings definitions.

read(self, reader)

Read and validate Bugzilla server settings.

validate(self)

This section is lazily validated on .issue_handlers.bugzilla.

class robottelo.config.base.CapsuleSettings(*args, **kwargs)

Bases: FeatureSettings

Clients settings definitions.

read(self, reader)

Read clients settings.

property hostname(self)
validate(self)

Validate capsule settings.

class robottelo.config.base.CertsSettings(*args, **kwargs)

Bases: FeatureSettings

Katello-certs settings definitions.

read(self, reader)

Read certs settings.

validate(self)

Validate certs settings.

class robottelo.config.base.ClientsSettings(*args, **kwargs)

Bases: FeatureSettings

Clients settings definitions.

read(self, reader)

Read clients settings.

validate(self)

Validate clients settings.

class robottelo.config.base.ContainerRepositorySettings(*args, **kwargs)

Bases: FeatureSettings

Settings for syncing containers from container registries

section = container_repo
repo_config_required = ['label', 'registry_url', 'registry_username', 'registry_password', 'repos_to_sync']
read(self, reader)

Read container repo settings and associated yaml file

validate(self)

Subclasses must implement this method in order to validade the settings and raise ImproperlyConfigured if any issue is found.

_validate_registry_configs(self, configs)
class robottelo.config.base.DistroSettings(*args, **kwargs)

Bases: FeatureSettings

Distro settings definitions.

read(self, reader)

Read distro settings.

validate(self)

Validate distro settings.

class robottelo.config.base.DockerSettings(*args, **kwargs)

Bases: FeatureSettings

Docker settings definitions.

read(self, reader)

Read docker settings.

validate(self)

Validate docker settings.

class robottelo.config.base.AzureRMSettings(*args, **kwargs)

Bases: FeatureSettings

Azure Resource Manager settings definitions.

read(self, reader)

Read AzureRM settings.

validate(self)

Validate AzureRM settings.

class robottelo.config.base.EC2Settings(*args, **kwargs)

Bases: FeatureSettings

AWS EC2 settings definitions.

read(self, reader)

Read AWS EC2 settings.

validate(self)

Validate AWS EC2 settings.

class robottelo.config.base.FakeManifestSettings(*args, **kwargs)

Bases: FeatureSettings

Fake manifest settings defintitions.

read(self, reader)

Read fake manifest settings.

validate(self)

Validate fake manifest settings.

class robottelo.config.base.GCESettings(*args, **kwargs)

Bases: FeatureSettings

Google Compute Engine settings definitions.

read(self, reader)

Read GCE settings.

validate(self)

Validate GCE settings.

class robottelo.config.base.RHSSOSettings(*args, **kwargs)

Bases: FeatureSettings

RHSSO settings definitions.

read(self, reader)

Read LDAP settings.

validate(self)

Validate RHSSO settings.

class robottelo.config.base.LDAPSettings(*args, **kwargs)

Bases: FeatureSettings

LDAP settings definitions.

read(self, reader)

Read LDAP settings.

validate(self)

Validate LDAP settings.

class robottelo.config.base.LDAPIPASettings(*args, **kwargs)

Bases: FeatureSettings

LDAP freeIPA settings definitions.

read(self, reader)

Read LDAP freeIPA settings.

validate(self)

Validate LDAP freeIPA settings.

class robottelo.config.base.OpenLDAPSettings(*args, **kwargs)

Bases: FeatureSettings

Open LDAP settings definitions.

read(self, reader)

Read Open LDAP settings.

validate(self)

Validate Open LDAP settings.

class robottelo.config.base.LibvirtHostSettings(*args, **kwargs)

Bases: FeatureSettings

Libvirt host settings definitions.

read(self, reader)

Read libvirt host settings.

validate(self)

Validate libvirt host settings.

class robottelo.config.base.FakeCapsuleSettings(*args, **kwargs)

Bases: FeatureSettings

Fake Capsule settings definitions.

read(self, reader)

Read fake capsule settings

validate(self)

Validate fake capsule settings.

class robottelo.config.base.RHEVSettings(*args, **kwargs)

Bases: FeatureSettings

RHEV settings definitions.

read(self, reader)

Read rhev settings.

validate(self)

Validate rhev settings.

class robottelo.config.base.VmWareSettings(*args, **kwargs)

Bases: FeatureSettings

VmWare settings definitions.

read(self, reader)

Read vmware settings.

validate(self)

Validate vmware settings.

class robottelo.config.base.DiscoveryISOSettings(*args, **kwargs)

Bases: FeatureSettings

Discovery ISO name settings definition.

read(self, reader)

Read discovery iso setting.

validate(self)

Validate discovery iso name setting.

class robottelo.config.base.OscapSettings(*args, **kwargs)

Bases: FeatureSettings

Oscap settings definitions.

read(self, reader)

Read Oscap settings.

validate(self)

Validate Oscap settings.

class robottelo.config.base.OSPSettings(*args, **kwargs)

Bases: FeatureSettings

OSP settings definitions.

read(self, reader)

Read osp settings.

validate(self)

Validate osp settings.

class robottelo.config.base.PerformanceSettings(*args, **kwargs)

Bases: FeatureSettings

Performance settings definitions.

read(self, reader)

Read performance settings.

validate(self)

Validate performance settings.

class robottelo.config.base.SSHClientSettings(*args, **kwargs)

Bases: FeatureSettings

SSHClient settings definitions.

property command_timeout(self)
property connection_timeout(self)
read(self, reader)

Read SSHClient settings.

validate(self)

Validate SSHClient settings.

class robottelo.config.base.VlanNetworkSettings(*args, **kwargs)

Bases: FeatureSettings

Vlan Network settings definitions.

read(self, reader)

Read Vlan Network settings.

validate(self)

Validate Vlan Network settings.

class robottelo.config.base.UpgradeSettings(*args, **kwargs)

Bases: FeatureSettings

Satellite upgrade settings definitions.

read(self, reader)

Read and validate Satellite server settings.

validate(self)

Subclasses must implement this method in order to validade the settings and raise ImproperlyConfigured if any issue is found.

class robottelo.config.base.SharedFunctionSettings(*args, **kwargs)

Bases: FeatureSettings

Shared function settings definitions.

MAX_SHARE_TIMEOUT = 86400
read(self, reader)

Read shared settings.

validate(self)

Validate the shared settings

class robottelo.config.base.VirtWhoSettings(*args, **kwargs)

Bases: FeatureSettings

VirtWho settings definitions.

read(self, reader)

Read virtwho settings.

validate(self)

Validate virtwho settings.

class robottelo.config.base.ReportPortalSettings(*args, **kwargs)

Bases: FeatureSettings

Report portal settings definitions.

read(self, reader)

Read Report portal settings.

validate(self)

Validate Report portal settings.

class robottelo.config.base.Settings

Robottelo’s settings representation.

configure(self, settings_path=None)

Read the settings file and parse the configuration.

Parameters

settings_path (str) – path to settings file to read. If None, looks in the project root for a file named ‘robottelo.properties’.

Raises

ImproperlyConfigured if any issue is found during the parsing or validation of the configuration.

_read_robottelo_settings(self)

Read Robottelo’s general settings.

_validate_robottelo_settings(self)

Validate Robottelo’s general settings.

property configured(self)

Returns True if the settings have already been configured.

property all_features(self)

List all expected feature settings sections.

class robottelo.config.base.HttpProxySettings(*args, **kwargs)

Bases: FeatureSettings

Http Proxy settings definitions.

read(self, reader)

Read Http Proxy settings.

validate(self)

Validate Http Proxy settings.

robottelo.config.casts

Configuration casts to help typing the settings.

Module Contents
Classes

Boolean

Cast a string to boolean.

List

Cast a comma separated string to a list.

LoggingLevel

Cast a string to a logging level.

Tuple

Cast a comma separated string to a tuple.

Dict

Cast a comma separated list of key=value to a dict.

WebdriverDesiredCapabilities

Cast a comma separated list of key=value to a

class robottelo.config.casts.Boolean

Cast a string to boolean.

String values 1, yes, true, on will result in python’s True. String values 0, no, false, off will result in python’s False.

Parameters

value (str) – A string to cast to boolean.

_booleans
__call__(self, value)
class robottelo.config.casts.List

Cast a comma separated string to a list.

Parameters

value (str) – A comma separated string to cast to a list.

__call__(self, value)
class robottelo.config.casts.LoggingLevel

Cast a string to a logging level.

Parameters

value (str) – A string to cast to a logging level.

_logging_levels
__call__(self, value)
class robottelo.config.casts.Tuple

Bases: List

Cast a comma separated string to a tuple.

Parameters

value (str) – A comma separated string to cast to a tuple.

__call__(self, value)
class robottelo.config.casts.Dict

Bases: List

Cast a comma separated list of key=value to a dict.

Parameters

value (str) – A comma separated string to cast to a dict.

__call__(self, value)
class robottelo.config.casts.WebdriverDesiredCapabilities

Bases: Dict

Cast a comma separated list of key=value to a webdriver.DesiredCapabilities dict.

Convert values true and false (ignore case) to a proper boolean.

Parameters

value (str) – A comma separated string to cast to a webdriver.DesiredCapabilities dict.

__call__(self, value)
robottelo.config.facade
Module Contents
Classes

SettingsNodeWrapper

SettingsFacade

Attributes

logger

WRAPPER_EXCEPTIONS

robottelo.config.facade.logger
robottelo.config.facade.WRAPPER_EXCEPTIONS = ['server.hostname', 'server.ssh_key', 'server.ssh_key_string', 'server.ssh_password',...
class robottelo.config.facade.SettingsNodeWrapper(wrapped, config_provider=None, full_path=None)

Bases: wrapt.CallableObjectProxy

__getattr__(self, name)
__dir__(self)

Default dir() implementation.

__fspath__(self)
__repr__(self)

Return repr(self).

configure_nailgun(self)

Configure NailGun’s entity classes.

Do the following:

  • Set entity_mixins.CREATE_MISSING to True. This causes method

    EntityCreateMixin.create_raw to generate values for empty and required fields.

  • Set nailgun.entity_mixins.DEFAULT_SERVER_CONFIG to whatever is

    returned by robottelo.helpers.get_nailgun_config(). See robottelo.entity_mixins.Entity for more information on the effects of this.

  • Set a default value for nailgun.entities.GPGKey.content.

configure_airgun(self)

Pass required settings to AirGun

configure_logging(self)

Configure logging for the entire framework.

If a config named logging.conf exists in Robottelo’s root directory, the logger is configured using the options in that file. Otherwise, a custom logging output format is set, and default values are used for all other logging options.

configure_third_party_logging(self)

Increase the level of third party packages logging.

class robottelo.config.facade.SettingsFacade
_cache
_configs = []
classmethod set_configs(cls, *configs)
classmethod _from_cache(cls, key)
classmethod _add_to_cache(cls, key, value)
static _cached_function(fn)
__all_features(self)
__server_get_credentials(self)

Return credentials for interacting with a Foreman deployment API.

Returns

A username-password pair.

Return type

tuple

__server_get_url(self)

Return the base URL of the Foreman deployment being tested.

The following values from the config file are used to build the URL:

  • [server] scheme (default: https)

  • [server] hostname (required)

  • [server] port (default: none)

Setting port to 80 does not imply that scheme is ‘https’. If port is 80 and scheme is unset, scheme will still default to ‘https’.

Returns

A URL.

Return type

str

__server_get_pub_url(self)

Return the pub URL of the server being tested.

The following values from the config file are used to build the URL:

  • main.server.hostname (required)

Returns

The pub directory URL.

Return type

str

__server_get_cert_rpm_url(self)

Return the Katello cert RPM URL of the server being tested.

The following values from the config file are used to build the URL:

  • main.server.hostname (required)

Returns

The Katello cert RPM URL.

Return type

str

__server_version(self)
__server_get_hostname(self, key='hostname')
__capsule_hostname(self)
__ssh_client_command_timeout(self)
__ssh_client_connection_timeout(self)
_robottelo_verbosity(self)

Casts logging level for robottelo framework, for more info refer robottelo.config.casts module

_fake_capsules_port_range(self)

Casts port ranges for fake capsules of type string into tuple

_dispatch_computed_value(self, key)
_dispatch_robottelo_value(self, key)

Returns robottelo setting with dynaconf object in stead of dynaconf.robottelo object

e.g self.verbosity instead of self.robottelo.verbosity

_dispatch_repos_value(self, key)

Returns repos setting with dynaconf object in stead of dynaconf.repos object

e.g self.capsule_repo instead of self.repos.capsule_repo

_get_from_configs(self, key)
get(self, full_path)
__dir__(self)

Default dir() implementation.

robottelo.config.validators
Module Contents
robottelo.config.validators.validators
robottelo.config.virtwho

Define and instantiate the configuration class for virtwho hypervisors.

Module Contents
Classes

SkuSettings

Sku settings definitions

EsxSettings

Esx settings definitions.

XenSettings

Xen settings definitions.

HypervSettings

Hyperv settings definitions.

RhevmSettings

Rhevm settings definitions.

LibvirtSettings

Libvirt settings definitions.

KubevirtSettings

Kubevirt settings definitions.

VirtwhoSettings

Virtwho’s settings representation.

Attributes

LOGGER

SETTINGS_FILE_NAME

robottelo.config.virtwho.LOGGER
robottelo.config.virtwho.SETTINGS_FILE_NAME = virtwho.properties
class robottelo.config.virtwho.SkuSettings(*args, **kwargs)

Bases: robottelo.config.base.FeatureSettings

Sku settings definitions

read(self, reader)

Read sku settings.

validate(self)

Validate sku settings.

class robottelo.config.virtwho.EsxSettings(*args, **kwargs)

Bases: robottelo.config.base.FeatureSettings

Esx settings definitions.

read(self, reader)

Read esx settings.

validate(self)

Validate esx settings.

class robottelo.config.virtwho.XenSettings(*args, **kwargs)

Bases: robottelo.config.base.FeatureSettings

Xen settings definitions.

read(self, reader)

Read xen settings.

validate(self)

Validate xen settings.

class robottelo.config.virtwho.HypervSettings(*args, **kwargs)

Bases: robottelo.config.base.FeatureSettings

Hyperv settings definitions.

read(self, reader)

Read hyperv settings.

validate(self)

Validate hyperv settings.

class robottelo.config.virtwho.RhevmSettings(*args, **kwargs)

Bases: robottelo.config.base.FeatureSettings

Rhevm settings definitions.

read(self, reader)

Read rhevm settings.

validate(self)

Validate rhevm settings.

class robottelo.config.virtwho.LibvirtSettings(*args, **kwargs)

Bases: robottelo.config.base.FeatureSettings

Libvirt settings definitions.

read(self, reader)

Read libvirt settings.

validate(self)

Validate libvirt settings.

class robottelo.config.virtwho.KubevirtSettings(*args, **kwargs)

Bases: robottelo.config.base.FeatureSettings

Kubevirt settings definitions.

read(self, reader)

Read kubevirt settings.

validate(self)

Validate kubevirt settings.

class robottelo.config.virtwho.VirtwhoSettings

Virtwho’s settings representation.

configure(self, settings_path=None)

Read the settings file and parse the configuration.

Parameters

settings_path (str) – path to settings file to read. If None, looks in the project root for a file named ‘robottelo.properties’.

Raises

ImproperlyConfigured if any issue is found during the parsing or validation of the configuration.

Package Contents
Classes

LegacySettings

Robottelo’s settings representation.

SettingsFacade

SettingsNodeWrapper

Functions

setting_is_set(option)

Return either True or False if a Robottelo section setting is

Attributes

dynaconf_validators

logger

legacy_settings

dynaconf_settings

settings_proxy

settings

robottelo.config.dynaconf_validators
exception robottelo.config.ImproperlyConfigured

Bases: Exception

Indicates that Robottelo somehow is improperly configured.

For example, if settings file can not be found or some required configuration is not defined.

class robottelo.config.LegacySettings

Robottelo’s settings representation.

configure(self, settings_path=None)

Read the settings file and parse the configuration.

Parameters

settings_path (str) – path to settings file to read. If None, looks in the project root for a file named ‘robottelo.properties’.

Raises

ImproperlyConfigured if any issue is found during the parsing or validation of the configuration.

_read_robottelo_settings(self)

Read Robottelo’s general settings.

_validate_robottelo_settings(self)

Validate Robottelo’s general settings.

property configured(self)

Returns True if the settings have already been configured.

property all_features(self)

List all expected feature settings sections.

class robottelo.config.SettingsFacade
_cache
_configs = []
classmethod set_configs(cls, *configs)
classmethod _from_cache(cls, key)
classmethod _add_to_cache(cls, key, value)
static _cached_function(fn)
__all_features(self)
__server_get_credentials(self)

Return credentials for interacting with a Foreman deployment API.

Returns

A username-password pair.

Return type

tuple

__server_get_url(self)

Return the base URL of the Foreman deployment being tested.

The following values from the config file are used to build the URL:

  • [server] scheme (default: https)

  • [server] hostname (required)

  • [server] port (default: none)

Setting port to 80 does not imply that scheme is ‘https’. If port is 80 and scheme is unset, scheme will still default to ‘https’.

Returns

A URL.

Return type

str

__server_get_pub_url(self)

Return the pub URL of the server being tested.

The following values from the config file are used to build the URL:

  • main.server.hostname (required)

Returns

The pub directory URL.

Return type

str

__server_get_cert_rpm_url(self)

Return the Katello cert RPM URL of the server being tested.

The following values from the config file are used to build the URL:

  • main.server.hostname (required)

Returns

The Katello cert RPM URL.

Return type

str

__server_version(self)
__server_get_hostname(self, key='hostname')
__capsule_hostname(self)
__ssh_client_command_timeout(self)
__ssh_client_connection_timeout(self)
_robottelo_verbosity(self)

Casts logging level for robottelo framework, for more info refer robottelo.config.casts module

_fake_capsules_port_range(self)

Casts port ranges for fake capsules of type string into tuple

_dispatch_computed_value(self, key)
_dispatch_robottelo_value(self, key)

Returns robottelo setting with dynaconf object in stead of dynaconf.robottelo object

e.g self.verbosity instead of self.robottelo.verbosity

_dispatch_repos_value(self, key)

Returns repos setting with dynaconf object in stead of dynaconf.repos object

e.g self.capsule_repo instead of self.repos.capsule_repo

_get_from_configs(self, key)
get(self, full_path)
__dir__(self)

Default dir() implementation.

class robottelo.config.SettingsNodeWrapper(wrapped, config_provider=None, full_path=None)

Bases: wrapt.CallableObjectProxy

__getattr__(self, name)
__dir__(self)

Default dir() implementation.

__fspath__(self)
__repr__(self)

Return repr(self).

configure_nailgun(self)

Configure NailGun’s entity classes.

Do the following:

  • Set entity_mixins.CREATE_MISSING to True. This causes method

    EntityCreateMixin.create_raw to generate values for empty and required fields.

  • Set nailgun.entity_mixins.DEFAULT_SERVER_CONFIG to whatever is

    returned by robottelo.helpers.get_nailgun_config(). See robottelo.entity_mixins.Entity for more information on the effects of this.

  • Set a default value for nailgun.entities.GPGKey.content.

configure_airgun(self)

Pass required settings to AirGun

configure_logging(self)

Configure logging for the entire framework.

If a config named logging.conf exists in Robottelo’s root directory, the logger is configured using the options in that file. Otherwise, a custom logging output format is set, and default values are used for all other logging options.

configure_third_party_logging(self)

Increase the level of third party packages logging.

robottelo.config.logger
robottelo.config.legacy_settings
robottelo.config.dynaconf_settings
robottelo.config.settings_proxy
robottelo.config.settings
robottelo.config.setting_is_set(option)

Return either True or False if a Robottelo section setting is set or not respectively.

robottelo.constants

Defines various constants

Submodules
robottelo.constants.repos

Only External Repos url specific constants module

Module Contents
robottelo.constants.repos.REPOS_URL
robottelo.constants.repos.CUSTOM_FILE_REPO = https://fixtures.pulpproject.org/file/
robottelo.constants.repos.CUSTOM_KICKSTART_REPO = http://ftp.cvut.cz/centos/8/BaseOS/x86_64/kickstart/
robottelo.constants.repos.CUSTOM_RPM_REPO = https://fixtures.pulpproject.org/rpm-signed/
robottelo.constants.repos.CUSTOM_RPM_SHA_512 = https://fixtures.pulpproject.org/rpm-with-sha-512/
robottelo.constants.repos.CUSTOM_MODULE_STREAM_REPO_1
robottelo.constants.repos.CUSTOM_MODULE_STREAM_REPO_2
robottelo.constants.repos.CUSTOM_SWID_TAG_REPO
robottelo.constants.repos.FAKE_0_YUM_REPO
robottelo.constants.repos.FAKE_1_YUM_REPO
robottelo.constants.repos.FAKE_2_YUM_REPO
robottelo.constants.repos.FAKE_3_YUM_REPO
robottelo.constants.repos.FAKE_4_YUM_REPO
robottelo.constants.repos.FAKE_5_YUM_REPO = http://{0}:{1}@rplevka.fedorapeople.org/fakerepo01/
robottelo.constants.repos.FAKE_6_YUM_REPO
robottelo.constants.repos.FAKE_7_YUM_REPO
robottelo.constants.repos.FAKE_8_YUM_REPO
robottelo.constants.repos.FAKE_9_YUM_REPO
robottelo.constants.repos.FAKE_10_YUM_REPO
robottelo.constants.repos.FAKE_11_YUM_REPO
robottelo.constants.repos.FAKE_YUM_DRPM_REPO = https://fixtures.pulpproject.org/drpm-signed/
robottelo.constants.repos.FAKE_YUM_SRPM_REPO = https://fixtures.pulpproject.org/srpm-signed/
robottelo.constants.repos.FAKE_YUM_SRPM_DUPLICATE_REPO = https://fixtures.pulpproject.org/srpm-duplicate/
robottelo.constants.repos.FAKE_YUM_MIXED_REPO
robottelo.constants.repos.FAKE_YUM_MD5_REPO = https://fixtures.pulpproject.org/rpm-with-md5/
robottelo.constants.repos.CUSTOM_PUPPET_REPO
robottelo.constants.repos.FAKE_0_PUPPET_REPO
robottelo.constants.repos.FAKE_1_PUPPET_REPO
robottelo.constants.repos.FAKE_2_PUPPET_REPO
robottelo.constants.repos.FAKE_3_PUPPET_REPO
robottelo.constants.repos.FAKE_4_PUPPET_REPO
robottelo.constants.repos.FAKE_5_PUPPET_REPO
robottelo.constants.repos.FAKE_6_PUPPET_REPO
robottelo.constants.repos.FAKE_7_PUPPET_REPO = http://{0}:{1}@rplevka.fedorapeople.org/fakepuppet01/
robottelo.constants.repos.FAKE_8_PUPPET_REPO
robottelo.constants.repos.FEDORA26_OSTREE_REPO = https://kojipkgs.fedoraproject.org/compose/ostree-20190207-old/26/
robottelo.constants.repos.FEDORA27_OSTREE_REPO = https://kojipkgs.fedoraproject.org/compose/ostree-20190207-old/26/
robottelo.constants.repos.OSTREE_REPO = https://fixtures.pulpproject.org/ostree/small/
robottelo.constants.repos.REPO_DISCOVERY_URL
robottelo.constants.repos.FAKE_0_INC_UPD_URL
robottelo.constants.repos.FAKE_PULP_REMOTE_FILEREPO
robottelo.constants.repos.FAKE_0_YUM_REPO_STRING_BASED_VERSIONS = https://fixtures.pulpproject.org/rpm-string-version-updateinfo/
Package Contents
robottelo.constants.LOCALES = ['ca', 'de', 'en', 'en_GB', 'es', 'fr', 'gl', 'it', 'ja', 'ko', 'pt_BR', 'ru', 'sv_SE', 'zh_CN', 'zh_TW']
robottelo.constants.DISTRO_RHEL6 = rhel6
robottelo.constants.DISTRO_RHEL7 = rhel7
robottelo.constants.DISTRO_RHEL8 = rhel8
robottelo.constants.DISTRO_SLES11 = sles11
robottelo.constants.DISTRO_SLES12 = sles12
robottelo.constants.RHEL_6_MAJOR_VERSION = 6
robottelo.constants.RHEL_7_MAJOR_VERSION = 7
robottelo.constants.RHEL_8_MAJOR_VERSION = 8
robottelo.constants.DISTRO_DEFAULT
robottelo.constants.DISTROS_SUPPORTED
robottelo.constants.DISTROS_MAJOR_VERSION
robottelo.constants.MAJOR_VERSION_DISTRO
robottelo.constants.BROKER_DEPLOY_WORKFLOW = deploy-base-rhel
robottelo.constants.BROKER_RHEL77
robottelo.constants.INTERFACE_API = API
robottelo.constants.INTERFACE_CLI = CLI
robottelo.constants.FOREMAN_PROVIDERS
robottelo.constants.EC2_REGION_CA_CENTRAL_1 = ca-central-1
robottelo.constants.CONTENT_CREDENTIALS_TYPES
robottelo.constants.VIRT_WHO_HYPERVISOR_TYPES
robottelo.constants.LIBVIRT_RESOURCE_URL = qemu+ssh://root@%s/system
robottelo.constants.RHEV_CR = %s (RHV)
robottelo.constants.AWS_EC2_FLAVOR_T2_MICRO = t2.micro - T2 Micro Instance
robottelo.constants.COMPUTE_PROFILE_LARGE = 3-Large
robottelo.constants.COMPUTE_PROFILE_SMALL = 1-Small
robottelo.constants._bcds
robottelo.constants._abcfs
robottelo.constants._abcs
robottelo.constants._zones_combo
robottelo.constants.VALID_GCE_ZONES
robottelo.constants.LATEST_RHEL7_GCE_IMG_UUID = 7726764279310511390
robottelo.constants.GCE_MACHINE_TYPE_DEFAULT = f1-micro
robottelo.constants.GCE_NETWORK_DEFAULT = default
robottelo.constants.GCE_EXTERNAL_IP_DEFAULT = True
robottelo.constants.AZURERM_VALID_REGIONS = ['East Asia', 'Southeast Asia', 'Central US', 'East US', 'East US 2', 'West US', 'North Central...
robottelo.constants.AZURERM_RHEL7_FT_IMG_URN = marketplace://RedHat:RHEL:7-RAW:latest
robottelo.constants.AZURERM_RHEL7_UD_IMG_URN = marketplace://RedHat:RHEL:7-RAW-CI:7.6.2019072418
robottelo.constants.AZURERM_RHEL7_FT_BYOS_IMG_URN = marketplace://RedHat:rhel-byos:rhel-lvm78:7.8.20200410
robottelo.constants.AZURERM_RHEL7_FT_CUSTOM_IMG_URN = custom://vm1-shared-image-20200514081407
robottelo.constants.AZURERM_RG_DEFAULT = SATQE
robottelo.constants.AZURERM_PLATFORM_DEFAULT = Linux
robottelo.constants.AZURERM_VM_SIZE_DEFAULT = Standard_B2ms
robottelo.constants.AZURERM_PREMIUM_OS_Disk = True
robottelo.constants.AZURERM_FILE_URI = https://raw.githubusercontent.com/SatelliteQE/robottelo/master/tests/foreman/data/uri.sh
robottelo.constants.HTML_TAGS = ['A', 'ABBR', 'ACRONYM', 'ADDRESS', 'APPLET', 'AREA', 'B', 'BASE', 'BASEFONT', 'BDO', 'BIG',...
robottelo.constants.OPERATING_SYSTEMS
robottelo.constants.TEMPLATE_TYPES = ['finish', 'iPXE', 'provision', 'PXEGrub', 'PXELinux', 'script', 'user_data', 'ZTP']
robottelo.constants.RESOURCE_DEFAULT = Bare Metal
robottelo.constants.OS_TEMPLATE_DATA_FILE = os_template.txt
robottelo.constants.DOMAIN = lab.dom.%s.com
robottelo.constants.PARTITION_SCRIPT_DATA_FILE = partition_script.txt
robottelo.constants.SNIPPET_DATA_FILE = snippet.txt
robottelo.constants.SNIPPET_URL = https://gist.github.com/sghai/8434467/raw
robottelo.constants.INSTALL_MEDIUM_URL = http://mirror.fakeos.org/%s/$major.$minor/os/$arch
robottelo.constants.VALID_GPG_KEY_FILE = valid_gpg_key.txt
robottelo.constants.ZOO_CUSTOM_GPG_KEY = zoo_custom_gpgkey.txt
robottelo.constants.VALID_GPG_KEY_BETA_FILE = valid_gpg_key_beta.txt
robottelo.constants.KEY_CLOAK_CLI = /opt/rh/rh-sso7/root/usr/share/keycloak/bin/kcadm.sh
robottelo.constants.RPM_TO_UPLOAD = which-2.19-6.el6.x86_64.rpm
robottelo.constants.SRPM_TO_UPLOAD = which-2.19-6.el6.src.rpm
robottelo.constants.ENVIRONMENT = Library
robottelo.constants.NOT_IMPLEMENTED = This is a Manual test!
robottelo.constants.SYNC_INTERVAL
robottelo.constants.REPO_TYPE
robottelo.constants.DOWNLOAD_POLICIES
robottelo.constants.CHECKSUM_TYPE
robottelo.constants.HASH_TYPE
robottelo.constants.REPO_TAB
robottelo.constants.PRDS
robottelo.constants.REPOSET
robottelo.constants.NO_REPOS_AVAILABLE = This system has no repositories available through subscriptions.
robottelo.constants.SM_OVERALL_STATUS
robottelo.constants.REPOS
robottelo.constants.DISTRO_REPOS
robottelo.constants.RHVA_REPO_TREE = [['rhel', 'rhva6', 'rhva65', 'repo_name', 'Red Hat Enterprise Virtualization Agents for RHEL 6...
robottelo.constants.SAT6_TOOLS_TREE = [['rhel', 'rhst6', 'rhst6', 'repo_name', 'Red Hat Satellite Tools 6.9 for RHEL 6 Server RPMs...
robottelo.constants.ATOMIC_HOST_TREE = [['rhah', 'rhaht', 'rhaht', 'repo_name', 'Red Hat Enterprise Linux Atomic Host Trees'], ['rhah',...
robottelo.constants.DEFAULT_ORG = Default Organization
robottelo.constants.DEFAULT_LOC = Default Location
robottelo.constants.DEFAULT_CV = Default Organization View
robottelo.constants.DEFAULT_TEMPLATE = Kickstart default
robottelo.constants.DEFAULT_PXE_TEMPLATE = Kickstart default PXELinux
robottelo.constants.DEFAULT_ATOMIC_TEMPLATE = Atomic Kickstart default
robottelo.constants.DEFAULT_PTABLE = Kickstart default
robottelo.constants.DEFAULT_SUBSCRIPTION_NAME = Red Hat Enterprise Linux Server, Premium (Physical or Virtual Nodes)
robottelo.constants.DEFAULT_ARCHITECTURE = x86_64
robottelo.constants.DEFAULT_RELEASE_VERSION = 6Server
robottelo.constants.DEFAULT_ROLE = Default role
robottelo.constants.LANGUAGES
robottelo.constants.SATELLITE_SUBSCRIPTION_NAME = Red Hat Satellite Infrastructure Subscription
robottelo.constants.SATELLITE_FIREWALL_SERVICE_NAME = RH-Satellite-6
robottelo.constants.VDC_SUBSCRIPTION_NAME = Red Hat Enterprise Linux for Virtual Datacenters, Premium
robottelo.constants.TIMEZONES = ['(GMT+00:00) UTC', '(GMT-10:00) Hawaii', '(GMT+02:00) Kyiv', '(GMT+08:00) Hong Kong',...
robottelo.constants.FILTER_CONTENT_TYPE
robottelo.constants.FILTER_TYPE
robottelo.constants.FILTER_ERRATA_TYPE
robottelo.constants.FILTER_ERRATA_DATE
robottelo.constants.REPORT_TEMPLATE_FILE = report_template.txt
robottelo.constants.REP_TEM_APPLIED_ERRATA_INPUT
robottelo.constants.CONTAINER_REGISTRY_HUB = https://mirror.gcr.io
robottelo.constants.CONTAINER_UPSTREAM_NAME = library/busybox
robottelo.constants.CONTAINER_RH_REGISTRY_UPSTREAM_NAME = openshift3/ose-metrics-hawkular-openshift-agent
robottelo.constants.CUSTOM_LOCAL_FOLDER = /var/www/html/myrepo/
robottelo.constants.CUSTOM_LOCAL_FILE = /var/www/html/myrepo/test.txt
robottelo.constants.CUSTOM_FILE_REPO_FILES_COUNT = 3
robottelo.constants.CUSTOM_RPM_SHA_512_FEED_COUNT
robottelo.constants.CUSTOM_REPODATA_PATH = /var/lib/pulp/published/yum/https/repos
robottelo.constants.CERT_PATH = /etc/pki/ca-trust/source/anchors/
robottelo.constants.FAKE_0_YUM_REPO_PACKAGES_COUNT = 32
robottelo.constants.FAKE_0_INC_UPD_ERRATA = EXA:2015-0002
robottelo.constants.FAKE_0_INC_UPD_OLD_PACKAGE = pulp-test-package-0.2.1-1.fc11.x86_64.rpm
robottelo.constants.FAKE_0_INC_UPD_NEW_PACKAGE = pulp-test-package-0.3.1-1.fc11.x86_64.rpm
robottelo.constants.FAKE_0_INC_UPD_OLD_UPDATEFILE = updateinfo.xml
robottelo.constants.FAKE_0_INC_UPD_NEW_UPDATEFILE = updateinfo_v2.xml
robottelo.constants.INVALID_URL = http://username:password@@example.com/repo
robottelo.constants.FAKE_0_CUSTOM_PACKAGE = bear-4.1-1.noarch
robottelo.constants.FAKE_0_CUSTOM_PACKAGE_NAME = bear
robottelo.constants.FAKE_1_CUSTOM_PACKAGE = walrus-0.71-1.noarch
robottelo.constants.FAKE_1_CUSTOM_PACKAGE_NAME = walrus
robottelo.constants.FAKE_2_CUSTOM_PACKAGE = walrus-5.21-1.noarch
robottelo.constants.FAKE_2_CUSTOM_PACKAGE_NAME = walrus
robottelo.constants.FAKE_3_CUSTOM_PACKAGE = duck-0.8-1.noarch
robottelo.constants.FAKE_3_CUSTOM_PACKAGE_NAME = duck
robottelo.constants.FAKE_4_CUSTOM_PACKAGE = kangaroo-0.1-1.noarch
robottelo.constants.FAKE_4_CUSTOM_PACKAGE_NAME = kangaroo
robottelo.constants.FAKE_5_CUSTOM_PACKAGE = kangaroo-0.2-1.noarch
robottelo.constants.REAL_0_RH_PACKAGE = rhevm-sdk-python-3.3.0.21-1.el6ev.noarch
robottelo.constants.REAL_RHEL7_0_0_PACKAGE = python-pulp-common-2.21.0-1.el7sat.noarch
robottelo.constants.REAL_RHEL7_0_0_PACKAGE_NAME = python-pulp-common
robottelo.constants.REAL_RHEL7_0_1_PACKAGE = python-pulp-common-2.21.0.2-1.el7sat.noarch
robottelo.constants.REAL_RHEL7_0_1_PACKAGE_FILENAME = python-pulp-common-2.21.0.2-1.el7sat.noarch.rpm
robottelo.constants.REAL_RHEL7_0_2_PACKAGE_NAME = python2-psutil
robottelo.constants.REAL_RHEL7_0_2_PACKAGE_FILENAME = python2-psutil-5.7.2-2.el7sat.x86_64.rpm
robottelo.constants.FAKE_0_CUSTOM_PACKAGE_GROUP_NAME = birds
robottelo.constants.FAKE_3_YUM_OUTDATED_PACKAGES = ['acme-package-1.0.1-1.noarch', 'ant-7.7.5-1.noarch', 'antelope-5.0.7-1.noarch',...
robottelo.constants.FAKE_9_YUM_OUTDATED_PACKAGES = ['bear-4.0-1.noarch', 'crow-0.7-1.noarch', 'duck-0.5-1.noarch', 'gorilla-0.61-1.noarch',...
robottelo.constants.FAKE_9_YUM_UPDATED_PACKAGES = ['bear-4.1-1.noarch', 'crow-0.8-1.noarch', 'duck-0.6-1.noarch', 'gorilla-0.62-1.noarch',...
robottelo.constants.FAKE_0_MODULAR_ERRATA_ID = RHEA-2012:0059
robottelo.constants.FAKE_0_ERRATA_ID = RHEA-2012:0001
robottelo.constants.FAKE_1_ERRATA_ID = RHEA-2012:0002
robottelo.constants.FAKE_2_ERRATA_ID = RHSA-2012:0055
robottelo.constants.FAKE_3_ERRATA_ID = RHEA-2012:3733
robottelo.constants.FAKE_4_ERRATA_ID = WALRUS-2013:0002
robottelo.constants.FAKE_5_ERRATA_ID = RHBA-2012:1030
robottelo.constants.REAL_0_ERRATA_ID = RHBA-2021:1314
robottelo.constants.REAL_1_ERRATA_ID = RHBA-2016:1357
robottelo.constants.REAL_2_ERRATA_ID = RHEA-2014:0657
robottelo.constants.REAL_4_ERRATA_ID = RHSA-2014:1873
robottelo.constants.REAL_4_ERRATA_CVES = ['CVE-2014-3633', 'CVE-2014-3657', 'CVE-2014-7823']
robottelo.constants.REAL_RHEL7_0_ERRATA_ID = RHBA-2020:3615
robottelo.constants.REAL_RHEL7_1_ERRATA_ID = RHBA-2017:0395
robottelo.constants.FAKE_0_YUM_ERRATUM_COUNT = 4
robottelo.constants.FAKE_1_YUM_ERRATUM_COUNT = 4
robottelo.constants.FAKE_1_YUM_REPOS_COUNT = 32
robottelo.constants.FAKE_2_YUM_ERRATUM_COUNT = 4
robottelo.constants.FAKE_3_YUM_ERRATUM_COUNT = 28
robottelo.constants.FAKE_3_YUM_REPOS_COUNT = 78
robottelo.constants.FAKE_6_YUM_ERRATUM_COUNT = 5
robottelo.constants.FAKE_9_YUM_ERRATUM_COUNT = 5
robottelo.constants.FAKE_9_YUM_ERRATUM = ['RHSA-2012:0055', 'RHSA-2012:0056', 'RHSA-2012:0057', 'RHEA-2012:0058', 'RHBA-2012:1030']
robottelo.constants.FAKE_9_YUM_SECURITY_ERRATUM = ['RHSA-2012:0055', 'RHSA-2012:0056', 'RHSA-2012:0057']
robottelo.constants.FAKE_9_YUM_SECURITY_ERRATUM_COUNT
robottelo.constants.FAKE_10_YUM_BUGFIX_ERRATUM = ['RHBA-2012:1030']
robottelo.constants.FAKE_10_YUM_BUGFIX_ERRATUM_COUNT
robottelo.constants.FAKE_11_YUM_ENHANCEMENT_ERRATUM = ['RHEA-2012:0058']
robottelo.constants.FAKE_11_YUM_ENHANCEMENT_ERRATUM_COUNT
robottelo.constants.PUPPET_MODULE_NTP_PUPPETLABS = puppetlabs-ntp-3.2.1.tar.gz
robottelo.constants.PUPPET_MODULE_CUSTOM_FILE_NAME = puppet_custom_selinux-0.3.1.tar.gz
robottelo.constants.PUPPET_MODULE_CUSTOM_NAME = selinux
robottelo.constants.FAKE_0_CUSTOM_PACKAGE_GROUP = ['cockateel-3.1-1.noarch', 'duck-0.6-1.noarch', 'penguin-0.9.1-1.noarch', 'stork-0.12-2.noarch']
robottelo.constants.FAKE_1_YUM_REPO_RPMS = ['bear-4.1-1.noarch.rpm', 'camel-0.1-1.noarch.rpm', 'cat-1.0-1.noarch.rpm']
robottelo.constants.FAKE_0_PUPPET_MODULE = httpd
robottelo.constants.FAKE_0_YUM_REPO_STRING_BASED_VERSIONS_COUNTS
robottelo.constants.PULP_PUBLISHED_ISO_REPOS_PATH = /var/lib/pulp/published/http/isos
robottelo.constants.PULP_PUBLISHED_PUPPET_REPOS_PATH = /var/lib/pulp/published/puppet/https/repos
robottelo.constants.PULP_PUBLISHED_YUM_REPOS_PATH = /var/lib/pulp/published/yum/http/repos
robottelo.constants.PERMISSIONS
robottelo.constants.PERMISSIONS_UI
robottelo.constants.ANY_CONTEXT
robottelo.constants.SUBNET_IPAM_TYPES
robottelo.constants.LDAP_SERVER_TYPE
robottelo.constants.LDAP_ATTR
robottelo.constants.OSCAP_PERIOD
robottelo.constants.OSCAP_WEEKDAY
robottelo.constants.OSCAP_DEFAULT_CONTENT
robottelo.constants.OSCAP_PROFILE
robottelo.constants.ROLES = ['Access Insights Admin', 'Access Insights Viewer', 'Ansible Roles Manager', 'Auditor', 'Boot...
robottelo.constants.ROLES_UNLOCKED = ['Access Insights Admin', 'Access Insights Viewer', 'Boot disk access', 'Compliance manager',...
robottelo.constants.ROLES_LOCKED = ['Discovery Manager', 'Discovery Reader', 'Edit hosts', 'Edit partition tables', 'Manager',...
robottelo.constants.BOOKMARK_ENTITIES
robottelo.constants.STRING_TYPES = ['alpha', 'numeric', 'alphanumeric', 'latin1', 'utf8', 'cjk', 'html']
robottelo.constants.REAL_4_ERRATA_DETAILS = [None, None, ['Type', 'Security Advisory'], ['Severity', 'Moderate'], ['Issued', '11/18/14'],...
robottelo.constants.TOOLS_ERRATA_DETAILS = [['Advisory', 'RHBA-2016:1503'], ['CVEs', 'N/A'], ['Type', 'Bug Fix Advisory'], ['Severity',...
robottelo.constants.TOOLS_ERRATA_TABLE_DETAILS = ['RHBA-2016:1503', 'Satellite 6.2 Tools Release', 'Bug Fix Advisory', 'Installable', '7/27/16']
robottelo.constants.BACKUP_FILES = ['config_files.tar.gz', '.config.snar', 'metadata.yml', 'mongo_data.tar.gz', '.mongo.snar',...
robottelo.constants.HOT_BACKUP_FILES = ['candlepin.dump', 'config_files.tar.gz', '.config.snar', 'foreman.dump', 'metadata.yml',...
robottelo.constants.VMWARE_CONSTANTS
robottelo.constants.HAMMER_CONFIG = ~/.hammer/cli.modules.d/foreman.yml
robottelo.constants.FOREMAN_TEMPLATE_IMPORT_URL = https://github.com/SatelliteQE/foreman_templates.git
robottelo.constants.FOREMAN_TEMPLATES_COMMUNITY_URL = https://github.com/theforeman/community-templates.git
robottelo.constants.FOREMAN_TEMPLATE_TEST_TEMPLATE = https://raw.githubusercontent.com/SatelliteQE/foreman_templates/example/example_template.erb
robottelo.constants.FOREMAN_TEMPLATE_ROOT_DIR = /usr/share/foreman_templates
robottelo.constants.DEFAULT_SYSPURPOSE_ATTRIBUTES
robottelo.constants.OPEN_STATUSES = ['NEW', 'ASSIGNED', 'POST', 'MODIFIED']
robottelo.constants.CLOSED_STATUSES = ['ON_QA', 'VERIFIED', 'RELEASE_PENDING', 'CLOSED']
robottelo.constants.WONTFIX_RESOLUTIONS = ['WONTFIX', 'CANTFIX', 'DEFERRED']
robottelo.constants.GROUP_MEMBERSHIP_MAPPER
robottelo.constants.AUDIENCE_MAPPER
robottelo.constants.RHSSO_NEW_USER
robottelo.constants.RHSSO_USER_UPDATE
robottelo.constants.RHSSO_NEW_GROUP
robottelo.constants.RHSSO_RESET_PASSWORD
robottelo.constants.FOREMAN_ANSIBLE_MODULES = ['foreman_architecture', 'foreman_auth_source_ldap', 'foreman_bookmark',...
robottelo.constants.FAM_MODULE_PATH = /usr/share/ansible/collections/ansible_collections/redhat/satellite/plugins/modules
robottelo.decorators

Implements various decorators

Subpackages
robottelo.decorators.func_shared
Submodules
robottelo.decorators.func_shared.base
Module Contents
Classes

BaseStorageHandler

class robottelo.decorators.func_shared.base.BaseStorageHandler
static encode(data)
static decode(data)
abstract lock(self, lock_key)

Return the storage locker context manager

abstract when_lock_acquired(self, data)

called when the lock is acquired to do some added action

abstract get(self, key)

Return the key value

abstract set(self, key, value)

Write the value of key to storage

robottelo.decorators.func_shared.file_storage
Module Contents
Classes

FileStorageHandler

Key value file storage handler.

Functions

get_temp_dir()

_get_root_dir(create=True)

Attributes

TEMP_ROOT_DIR

TEMP_FUNC_SHARED_DIR

SHARED_DIR

logger

LOCK_TIMEOUT

robottelo.decorators.func_shared.file_storage.TEMP_ROOT_DIR = robottelo
robottelo.decorators.func_shared.file_storage.TEMP_FUNC_SHARED_DIR = shared_functions
robottelo.decorators.func_shared.file_storage.SHARED_DIR
robottelo.decorators.func_shared.file_storage.logger
robottelo.decorators.func_shared.file_storage.LOCK_TIMEOUT = 7200
robottelo.decorators.func_shared.file_storage.get_temp_dir()
robottelo.decorators.func_shared.file_storage._get_root_dir(create=True)
class robottelo.decorators.func_shared.file_storage.FileStorageHandler(root_dir=None, create=True, lock_timeout=LOCK_TIMEOUT)

Bases: robottelo.decorators.func_shared.base.BaseStorageHandler

Key value file storage handler.

property root_dir(self)
get_key_file_path(self, key)
lock(self, key)

Return the storage locker context manager

when_lock_acquired(self, handler)

Write the process id to file handler

get(self, key)

Return the key value :type key: str

set(self, key, value)

Write the value of key

robottelo.decorators.func_shared.redis_storage
Module Contents
Classes

RedisStorageHandler

Redis Key value storage handler

Attributes

redis

REDIS_HOST

REDIS_PORT

REDIS_DB

REDIS_PASSWORD

LOCK_TIMEOUT

robottelo.decorators.func_shared.redis_storage.redis
robottelo.decorators.func_shared.redis_storage.REDIS_HOST = localhost
robottelo.decorators.func_shared.redis_storage.REDIS_PORT = 6379
robottelo.decorators.func_shared.redis_storage.REDIS_DB = 0
robottelo.decorators.func_shared.redis_storage.REDIS_PASSWORD
robottelo.decorators.func_shared.redis_storage.LOCK_TIMEOUT = 7200
class robottelo.decorators.func_shared.redis_storage.RedisStorageHandler(host=REDIS_HOST, port=REDIS_PORT, db=REDIS_DB, password=REDIS_PASSWORD, lock_timeout=LOCK_TIMEOUT)

Bases: robottelo.decorators.func_shared.base.BaseStorageHandler

Redis Key value storage handler

property client(self)
lock(self, key, timeout=None)

Return the storage locker context manager

when_lock_acquired(self, lock_object)

called when the lock is acquired to do some added action

get(self, key)

Return the key value

set(self, key, value)

Write the value of key

robottelo.decorators.func_shared.shared

Shared function is a decorator, that enable a function once called to store the results to storage, any ulterior call from the same or other processes will return the stored results, which make the shared function results persistent.

Note: Shared function store it’s data as json. The results of the decorated

function must be json compatible.

Usage:

from robottelo.decorators.func_shared.shared import shared

@shared
def module_level_shared(*args, **kwargs):
    # do some
    # the result of a shared function must be json compatible
    return any_data

class SomeTestCase1(TestCase):

    @shared
    def _shared_function(cls):

        org = make_org()
        # upload manifest
        repo = make_repository()
        return dict(org=org, repo=repo}

    @classmethod
    @shared
    def setUpClass(cls):

        data = cls._shared_function()
        other_data = module_level_shared()

        cls.org = data['org']
        cls.repo = data['repo']
        return

# the shared function can be called an other time to be able to initiate
# specific data

class SomeTestCase2(TestCase):

    @classmethod
    @shared(inject=True, injected_kw='_injected')
    def setUpClass(cls, org=None, repo=None, _injected=False):

        if _injected:
            cls.org = org
            cls.repo = repo
        else:
            # create the org
            cls.org = make_org()
            # upload manifest
            cls.repo = make_repository()

        # create a virtual machine

        # shared function with injected=True, must return a dict
        # the resulting dictionary will be injected in other calls as
        # kwargs, an added bool kw argument by default named _injected
        # should be added to the function kwargs, to be able to be notified
        # that the kwargs are injected from already stored result
        return dict(org=cls.org, repo=cls.repo}

    # in case we do not want the injected key word in kwargs
    # simply , declare injected_kw=None
    @classmethod
    @shared(inject=True, injected_kw=None)
    def shared_class_method(cls, org=None, repo=None):
         if org is not None:
            cls.org = org
         else:
            # create the org
            cls.org = make_org()
            # upload manifest
         if repo_id is not None:
            cls.repo = repo
         else:
            cls.repo = make_repository()

        # create a virtual machine

        return dict(org=cls.org, repo=cls.repo}
Module Contents
Classes

_SharedFunction

Internal class helper that is created each time the shared function is

Functions

_set_configured(value)

_check_config()

enable_shared_function(value)

force and override settings, by setting the global use shared data

set_default_scope(value)

Set the default namespace scope

_get_default_scope()

Return the shared function default scope

_get_default_storage_handler()

Return the storage handler instance

_get_kwargs_md5(**kwargs)

Create an md5 hexdigest from kwargs

_get_scope_name(scope=None, scope_kwargs=None, scope_context=None)

_get_function_name(function, class_name=None, kwargs=None)

Return a string representation of the function as

_get_function_name_key(function_name, scope=None, scope_kwargs=None, scope_context=None)

shared(function_=None, scope=_get_default_scope, scope_context=None, scope_kwargs=None, timeout=SHARE_DEFAULT_TIMEOUT, retries=DEFAULT_CALL_RETRIES, function_kw=None, inject=False, injected_kw='_injected')

Generic function sharing, share the results of any decorated function.

Attributes

logger

_storage_handlers

DEFAULT_STORAGE_HANDLER

ENABLED

NAMESPACE_SCOPE

SHARE_DEFAULT_TIMEOUT

DEFAULT_CALL_RETRIES

_configured

_NAMESPACE_SCOPE_KEY_TYPE

_DEFAULT_CLASS_NAME_DEPTH

_STATE_READY

_STATE_FAILED

_DATETIME_FORMAT

_SERVER_CERT_MD5

robottelo.decorators.func_shared.shared.logger
robottelo.decorators.func_shared.shared._storage_handlers
robottelo.decorators.func_shared.shared.DEFAULT_STORAGE_HANDLER = file
robottelo.decorators.func_shared.shared.ENABLED = False
robottelo.decorators.func_shared.shared.NAMESPACE_SCOPE
robottelo.decorators.func_shared.shared.SHARE_DEFAULT_TIMEOUT = 86400
robottelo.decorators.func_shared.shared.DEFAULT_CALL_RETRIES = 2
robottelo.decorators.func_shared.shared._configured = False
robottelo.decorators.func_shared.shared._NAMESPACE_SCOPE_KEY_TYPE = shared_function
robottelo.decorators.func_shared.shared._DEFAULT_CLASS_NAME_DEPTH = 3
robottelo.decorators.func_shared.shared._STATE_READY = READY
robottelo.decorators.func_shared.shared._STATE_FAILED = FAILED
robottelo.decorators.func_shared.shared._DATETIME_FORMAT = %Y-%m-%dT%H:%M:%S
robottelo.decorators.func_shared.shared._SERVER_CERT_MD5
robottelo.decorators.func_shared.shared._set_configured(value)
robottelo.decorators.func_shared.shared._check_config()
robottelo.decorators.func_shared.shared.enable_shared_function(value)

force and override settings, by setting the global use shared data attribute

robottelo.decorators.func_shared.shared.set_default_scope(value)

Set the default namespace scope :type value: str or callable

robottelo.decorators.func_shared.shared._get_default_scope()

Return the shared function default scope

robottelo.decorators.func_shared.shared._get_default_storage_handler()

Return the storage handler instance

exception robottelo.decorators.func_shared.shared.SharedFunctionError

Bases: Exception

Shared function related exception

exception robottelo.decorators.func_shared.shared.SharedFunctionException

Bases: Exception

Shared function call exception when not able to restore the original exception

class robottelo.decorators.func_shared.shared._SharedFunction(function_key, function, args=None, kwargs=None, retries=DEFAULT_CALL_RETRIES, storage_handler=None, timeout=SHARE_DEFAULT_TIMEOUT, inject=False, injected_kw='_inject')

Internal class helper that is created each time the shared function is launched and group all the necessary functionality

property storage(self)
property key(self)
property transaction(self)
_encode_result_kwargs(self, kwargs)

look for some special kwargs and convert them

_call_function(self)
_has_result_expired(self, creation_datetime)
__call__(self)
robottelo.decorators.func_shared.shared._get_kwargs_md5(**kwargs)

Create an md5 hexdigest from kwargs

robottelo.decorators.func_shared.shared._get_scope_name(scope=None, scope_kwargs=None, scope_context=None)
robottelo.decorators.func_shared.shared._get_function_name(function, class_name=None, kwargs=None)

Return a string representation of the function as module_path.Class_name.function_name

note: the class name is the first parent class

robottelo.decorators.func_shared.shared._get_function_name_key(function_name, scope=None, scope_kwargs=None, scope_context=None)
robottelo.decorators.func_shared.shared.shared(function_=None, scope=_get_default_scope, scope_context=None, scope_kwargs=None, timeout=SHARE_DEFAULT_TIMEOUT, retries=DEFAULT_CALL_RETRIES, function_kw=None, inject=False, injected_kw='_injected')

Generic function sharing, share the results of any decorated function. Any parallel pytest xdist worker will wait for this function to finish

Parameters
  • function (callable) – the function that is intended to be shared

  • scope (str or callable) – this parameter will define the namespace of data sharing

  • scope_context (str) – an added context string if applicable, of a concrete sharing in combination with scope and function.

  • scope_kwargs (dict) – kwargs to be passed to scope if is a callable

  • timeout (int) – the time in seconds to wait for waiting the shared function

  • retries (int) – if the shared function call fail, how much time should retry before setting the call with in failure state

  • function_kw (list) – The function kwargs to use as an additional scope, an md5 hexdigest of that kwargs will be created and added to the storage scope, that way we should have diffrent stored values for diffrent kw values.

  • inject (bool) – whether to recall the function with injecting the result as **kwargs

  • injected_kw (str) – the kw arg to set to True to inform the function that the kwargs was injected from a saved storage

Package Contents
exception robottelo.decorators.func_shared.SharedFunctionError

Bases: Exception

Shared function related exception

exception robottelo.decorators.func_shared.SharedFunctionException

Bases: Exception

Shared function call exception when not able to restore the original exception

Submodules
robottelo.decorators.func_locker

Implements test function locking, using pytest_services file locking

Usage:

from robottelo.decorators.func_locker import (
    locking_function,
    lock_function,
 )

# in many cases we have tests that need some test functions to run isolated
# from other py.test workers when used in --boxed mode
class SomeTestCase(TestCase):

    @classmethod
    @lock_function
    def setUpClass(cls):
        pass

# in other cases we want only a portion of the test function to be isolated
class SomeTestCase(TestCase):

    @classmethod
    def setUpClass(cls):

        with locking_function(cls.setUpClass,
                              scope_context='publish_puppet_class'):
            # call the publish function


# some tests can be in conflicts with other tests parts
class SomeTestCase(TestCase):

   @lock_function
   def test_to_lock(self):
      pass

   def test_that_conflict_with_test_to_lock(self)
        with locking_function(self.test_to_lock):
            # do some operations that conflict with test_to_lock
Module Contents
Functions

set_default_scope(value)

Set the default namespace scope

_get_default_scope()

get_temp_dir()

_get_temp_lock_function_dir(create=True)

_get_scope_path(scope, scope_kwargs=None, scope_context=None, create=True)

Returns the scopes path and create it if create is true

_get_function_name(function, class_name=None)

Return a string representation of the function as

_get_function_name_lock_path(function_name, scope=None, scope_kwargs=None, scope_context=None)

Return the path of the file to lock

_check_deadlock(lock_file_path, process_id)

To prevent process deadlock, raise exception if the file content is the

_write_content(handler, content)

write content to locked file

lock_function(function=None, scope=_get_default_scope, scope_context=None, scope_kwargs=None, timeout=LOCK_DEFAULT_TIMEOUT)

Generic function locker, lock any decorated function. Any parallel

locking_function(function, scope=_get_default_scope, scope_context=None, scope_kwargs=None, timeout=LOCK_DEFAULT_TIMEOUT)

Lock a function in combination with a scope and scope_context.

Attributes

logger

TEMP_ROOT_DIR

TEMP_FUNC_LOCK_DIR

LOCK_DIR

LOCK_DEFAULT_TIMEOUT

LOCK_FILE_NAME_EXT

LOCK_DEFAULT_SCOPE

_DEFAULT_CLASS_NAME_DEPTH

robottelo.decorators.func_locker.logger
robottelo.decorators.func_locker.TEMP_ROOT_DIR = robottelo
robottelo.decorators.func_locker.TEMP_FUNC_LOCK_DIR = lock_functions
robottelo.decorators.func_locker.LOCK_DIR
robottelo.decorators.func_locker.LOCK_DEFAULT_TIMEOUT = 1800
robottelo.decorators.func_locker.LOCK_FILE_NAME_EXT = lock
robottelo.decorators.func_locker.LOCK_DEFAULT_SCOPE
robottelo.decorators.func_locker._DEFAULT_CLASS_NAME_DEPTH = 3
exception robottelo.decorators.func_locker.FunctionLockerError

Bases: Exception

the default function locker error

robottelo.decorators.func_locker.set_default_scope(value)

Set the default namespace scope

robottelo.decorators.func_locker._get_default_scope()
robottelo.decorators.func_locker.get_temp_dir()
robottelo.decorators.func_locker._get_temp_lock_function_dir(create=True)
robottelo.decorators.func_locker._get_scope_path(scope, scope_kwargs=None, scope_context=None, create=True)

Returns the scopes path and create it if create is true

robottelo.decorators.func_locker._get_function_name(function, class_name=None)

Return a string representation of the function as module_path.Class_name.function_name

note: the class name is the first parent class

robottelo.decorators.func_locker._get_function_name_lock_path(function_name, scope=None, scope_kwargs=None, scope_context=None)

Return the path of the file to lock

robottelo.decorators.func_locker._check_deadlock(lock_file_path, process_id)

To prevent process deadlock, raise exception if the file content is the same as process_id

note: this function is called before the lock

robottelo.decorators.func_locker._write_content(handler, content)

write content to locked file

robottelo.decorators.func_locker.lock_function(function=None, scope=_get_default_scope, scope_context=None, scope_kwargs=None, timeout=LOCK_DEFAULT_TIMEOUT)
Generic function locker, lock any decorated function. Any parallel

pytest xdist worker will wait for this function to finish

Parameters
  • function (callable) – the function that is intended to be locked

  • scope (str or callable) – this parameter will define the namespace of locking

  • scope_context (str) – an added context string if applicable, of a concrete lock in combination with scope and function.

  • scope_kwargs (dict) – kwargs to be passed to scope if is a callable

  • timeout (int) – the time in seconds to wait for acquiring the lock

robottelo.decorators.func_locker.locking_function(function, scope=_get_default_scope, scope_context=None, scope_kwargs=None, timeout=LOCK_DEFAULT_TIMEOUT)

Lock a function in combination with a scope and scope_context. Any parallel pytest xdist worker will wait for this function to finish.

Parameters
  • function (callable) – the function that is intended to be locked

  • scope (str or callable) – this parameter will define the namespace of locking

  • scope_context (str) – an added context string if applicable, of a concrete lock in combination with scope and function.

  • scope_kwargs (dict) – kwargs to be passed to scope if is a callable

  • timeout (int) – the time in seconds to wait for acquiring the lock

robottelo.decorators.host

Implements decorator regarding satellite host

Module Contents
Functions

skip_if_os(*versions)

Decorator to skip tests based on host version

Attributes

LOGGER

robottelo.decorators.host.LOGGER
robottelo.decorators.host.skip_if_os(*versions)

Decorator to skip tests based on host version

If the calling function uses ‘RHEL6’ - test will be skipped for RHEL6, but will run for whatever another version, e.g, RHEL5, RHEL6.1, RHEL7, and so on

Note: If the version can’t be obtained, tests will run

Usage:

To skip a specific test:

from robottelo.decorators.host import skip_if_host_is

@skip_if_os('RHEL6')
def test_hostgroup_create():
    # test code continues here
Parameters

versions (tuple) – args containing host versions for which test must be skipped

Returns

unittest2.skipIf

Package Contents
Functions

cacheable(func)

Decorator that makes an optional object cache available

Attributes

LOGGER

OBJECT_CACHE

robottelo.decorators.LOGGER
robottelo.decorators.OBJECT_CACHE
robottelo.decorators.cacheable(func)[source]

Decorator that makes an optional object cache available

robottelo.report_portal
Submodules
robottelo.report_portal.portal
Module Contents
Classes

ReportPortal

Represents ReportPortal

Launch

Attributes

LOGGER

launch_types

robottelo.report_portal.portal.LOGGER
robottelo.report_portal.portal.launch_types = ['satellite6', 'upgrades']
class robottelo.report_portal.portal.ReportPortal

Represents ReportPortal

This holds the properties and functions to interact with Report Portal properties and launches

defect_types
statuses = ['failed', 'passed', 'skipped', 'interrupted', 'in_progress']
property api_url(self)

Super url of report portal :returns: Base url for API request

property headers(self)

The headers for Report Portal Requests. :returns: header for API request

_format_launches(self, launches)

The pretty formatter function that formats launches in a structured way

Parameters

launches (filter) – Satellite or Upgrade Type launches

Returns dict

Launches, keyed with their snap_versions formatted as, {‘snap_version1’:launch_object1, ‘snap_version2’: launch_object2}

_launch_requester(self)

The launch GET requester to fetch the all available launches of ReportPortal

Returns dict

The json of all RP launches

launches(self, sat_version=None, launch_type='satellite6')

Returns launches in Report Portal customized by sat_version, launch_type and latest number of launches sorted by latest sat version/snap version.

This does not includes each tests data for all tests in all launches, but it includes just an overview data for all and each launch in Report Portal

Parameters
  • sat_version (str) – The satellite version If its not specified, then latest count of launches of satellite versions returned

  • launch_type (str) – Either satellite6 or upgrades, default returns only non-upgrade launches

Returns dict

The launches of Report portal. if sat_version is given, `{'snap_version1':launch_object1, 'snap_version2':launch_object2}` else, `{'sat_version1':{'snap_version1':launch_object1, ..}, 'sat_version2':{}}`

launch(self, sat_version, snap_version=None, launch_type='satellite6')

Returns a specific launch data in Report Portal Project

This does not includes each tests data in launch

Parameters
  • sat_version (str) – The satellite version

  • snap_version (str) – The snap version of a given satellite version if None, the latest launch data of a given sat_version is returned

  • launch_type (str) – Either satellite6 or upgrades, default returns only non-upgrade launches

Returns dict

The data directory of requested or latest launch

class robottelo.report_portal.portal.Launch(rp, launch_info)
_versions(self)

Sets satellite and snap version attributes of a launch

_test_params(self, status, defect_type, user)

Customise parameters for Test items API request

Returns dict

The parameters dict for API test items request

_test_requester(self, params, page)

The Test Items GET requester to fetch the data on a page

If any error and before Failing explicitly, it retries for 3 times with 10 seconds delay

Returns tuple (int, list)

Total pages count and the list of tests along with each tests properties in a page

tests(self, status=None, defect_type=None, user=None)

Returns tests data customized by kwargs parameters.

This is a main function that will be called to retrieve the tests data of a particular test status or/and defect_type

Parameters
  • status (str) – Filter tests of a launch with tests status

  • defect_type (str) – Filter tests of a launch with tests defect_type

Returns dict

All filtered tests dict based on params data keyed by test name and test properties as value, in format - `{'test_name1':test1_properties_dict, 'test_name2':test2_properties_dict}`

robottelo.ui
Submodules
robottelo.ui.utils
Module Contents
Functions

create_fake_host(session, host, interface_id=gen_string('alpha'), global_parameters=None, host_parameters=None, extra_values=None)

robottelo.ui.utils.create_fake_host(session, host, interface_id=gen_string('alpha'), global_parameters=None, host_parameters=None, extra_values=None)
robottelo.utils
Subpackages
robottelo.utils.issue_handlers
Submodules
robottelo.utils.issue_handlers.bugzilla
Module Contents
Functions

is_open_bz(issue, data=None)

Check if specific BZ is open consulting a cached data dict or

should_deselect_bz(issue, data=None)

Check if test should be deselected based on marked issue.

follow_duplicates(bz)

Recursivelly load the duplicate data

extract_min_version(bz)

return target_milestone or min(versions flags) or 0

try_from_cache(issue, data=None)

Try to fetch issue from given data cache or previous loaded on pytest.

collect_data_bz(collected_data, cached_data)

Collect data from BUgzilla API and aggregate in a dictionary.

collect_dupes(bz, collected_data, cached_data=None)

Recursivelly find for duplicates

collect_clones(bz, collected_data, cached_data=None)

Recursivelly find for clones.

get_data_bz(bz_numbers, cached_data=None)

Get a list of marked BZ data and query Bugzilla REST API.

get_single_bz(number, cached_data=None)

Call BZ API to get a single BZ data and cache it

get_default_bz(number)

This is the default BZ data when it is not possible to reach BZ api

Attributes

LOGGER

VERSION_RE

CACHED_RESPONSES

robottelo.utils.issue_handlers.bugzilla.LOGGER
robottelo.utils.issue_handlers.bugzilla.VERSION_RE
robottelo.utils.issue_handlers.bugzilla.is_open_bz(issue, data=None)

Check if specific BZ is open consulting a cached data dict or calling Bugzilla REST API.

Arguments:

issue {str} – The BZ reference e.g: BZ:123456 data {dict} – Issue data indexed by <handler>:<number> or None

robottelo.utils.issue_handlers.bugzilla.should_deselect_bz(issue, data=None)

Check if test should be deselected based on marked issue.

  1. Resolution WONTFIX/CANTFIX/DEFERRED should deselect

Arguments:

issue {str} – The BZ reference e.g: BZ:123456 data {dict} – Issue data indexed by <handler>:<number> or None

robottelo.utils.issue_handlers.bugzilla.follow_duplicates(bz)

Recursivelly load the duplicate data

robottelo.utils.issue_handlers.bugzilla.extract_min_version(bz)

return target_milestone or min(versions flags) or 0

robottelo.utils.issue_handlers.bugzilla.try_from_cache(issue, data=None)

Try to fetch issue from given data cache or previous loaded on pytest.

Arguments:

issue {str} – The BZ reference e.g: BZ:123456 data {dict} – Issue data indexed by <handler>:<number> or None

robottelo.utils.issue_handlers.bugzilla.collect_data_bz(collected_data, cached_data)

Collect data from BUgzilla API and aggregate in a dictionary.

Arguments:

collected_data {dict} – dict with BZs collected by pytest cached_data {dict} – Cached data previous loaded from API

robottelo.utils.issue_handlers.bugzilla.collect_dupes(bz, collected_data, cached_data=None)

Recursivelly find for duplicates

robottelo.utils.issue_handlers.bugzilla.collect_clones(bz, collected_data, cached_data=None)

Recursivelly find for clones. This handler does not process clones as part of skipping logic. but the data is fetched here to feed nagger script later.

robottelo.utils.issue_handlers.bugzilla.CACHED_RESPONSES
robottelo.utils.issue_handlers.bugzilla.get_data_bz(bz_numbers, cached_data=None)

Get a list of marked BZ data and query Bugzilla REST API.

Arguments:

bz_numbers {list of str} – [‘123456’, …] cached_data

Returns:

[list of dicts] – [{‘id’:…, ‘status’:…, ‘resolution’: …}]

robottelo.utils.issue_handlers.bugzilla.get_single_bz(number, cached_data=None)

Call BZ API to get a single BZ data and cache it

robottelo.utils.issue_handlers.bugzilla.get_default_bz(number)

This is the default BZ data when it is not possible to reach BZ api

Package Contents
Functions

add_workaround(data, matches, usage, validation=lambda *a, **k: True, **kwargs)

Adds entry for workaround usage.

should_deselect(issue, data=None)

Check if test should be deselected based on marked issue.

is_open(issue, data=None)

Check if specific issue is open.

Attributes

handler_methods

SUPPORTED_HANDLERS

robottelo.utils.issue_handlers.handler_methods
robottelo.utils.issue_handlers.SUPPORTED_HANDLERS
robottelo.utils.issue_handlers.add_workaround(data, matches, usage, validation=lambda *a, **k: ..., **kwargs)

Adds entry for workaround usage.

robottelo.utils.issue_handlers.should_deselect(issue, data=None)

Check if test should be deselected based on marked issue.

robottelo.utils.issue_handlers.is_open(issue, data=None)

Check if specific issue is open.

Issue must be prefixed by its handler e.g:

Bugzilla: BZ:123456

Arguments:

issue {str} – A string containing handler + number e.g: BZ:123465 data {dict} – Issue data indexed by <handler>:<number> or None

Submodules
robottelo.utils.version
Module Contents
Classes

VersionEncoder

Transform Version instances to str

Functions

search_version_key(key, value)

recursively look for ‘version’ key and transform it in a Version instance

robottelo.utils.version.search_version_key(key, value)[source]

recursively look for ‘version’ key and transform it in a Version instance

class robottelo.utils.version.VersionEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]

Bases: json.JSONEncoder

Transform Version instances to str

default(self, z)[source]

Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError).

For example, to support arbitrary iterators, you could implement default like this:

def default(self, o):
    try:
        iterable = iter(o)
    except TypeError:
        pass
    else:
        return list(iterable)
    # Let the base class default method raise the TypeError
    return JSONEncoder.default(self, o)

Submodules

robottelo.cleanup

Cleanup module for different entities

Module Contents
Functions

capsule_cleanup(proxy_id=None)

Deletes the capsule with the given id

realm_cleanup(realm_id=None)

Deletes the realm with the given id

location_cleanup(loc_id=None)

Deletes the location with the given id

org_cleanup(org_id=None)

Deletes the Org with the given id

host_cleanup(host_id=None)

Deletes the Host with the given id

setting_cleanup(setting_name=None, setting_value=None)

Put necessary value for a specified setting

vm_cleanup(vm)

Destroys virtual machine

cleanup_of_provisioned_server(hostname=None, provisioning_server=None, distro=None)

Cleanup the VM from provisioning server

Attributes

LOGGER

robottelo.cleanup.LOGGER
robottelo.cleanup.capsule_cleanup(proxy_id=None)

Deletes the capsule with the given id

robottelo.cleanup.realm_cleanup(realm_id=None)

Deletes the realm with the given id

robottelo.cleanup.location_cleanup(loc_id=None)

Deletes the location with the given id

robottelo.cleanup.org_cleanup(org_id=None)

Deletes the Org with the given id

robottelo.cleanup.host_cleanup(host_id=None)

Deletes the Host with the given id

robottelo.cleanup.setting_cleanup(setting_name=None, setting_value=None)

Put necessary value for a specified setting

robottelo.cleanup.vm_cleanup(vm)

Destroys virtual machine

Parameters

vm (robottelo.vm.VirtualMachine) – virtual machine to destroy

robottelo.cleanup.cleanup_of_provisioned_server(hostname=None, provisioning_server=None, distro=None)

Cleanup the VM from provisioning server

Param

str hostname: The content host hostname

Param

str provisioning_server: provision server name

Param

str distro: distro type

robottelo.datafactory

Data Factory for all entities

Module Contents
Functions

filtered_datapoint(func)

Overrides the data creator functions in this class to return 1 value and

parametrized(data)

Transforms data dictionary to pytest’s parametrize acceptable format.

generate_strings_list(length=None, exclude_types=None, min_length=3, max_length=30)

Generates a list of different input strings.

add_uppercase_char_into_string(text=None, length=10)

Fix string to include a minimum of one uppercase character.

invalid_emails_list()

Returns a list of invalid emails.

invalid_boolean_strings(list_len=10)

Create a list of invalid booleans. E.g not true nor false

xdist_adapter(argvalues)

Adapter to avoid error when running tests on xdist

invalid_id_list()

Generates a list of invalid IDs.

invalid_names_list()

Generates a list of invalid names.

valid_domain_names(interface=None, length=None)

Valid domain names.

invalid_domain_names(interface=None)

Invalid domain names.

invalid_usernames_list()

invalid_values_list(interface=None)

Generates a list of invalid input values.

valid_data_list(interface=None)

Generates a list of valid input values.

valid_docker_repository_names()

Generates a list of valid names for Docker repository.

valid_emails_list()

Returns a list of valid emails.

valid_environments_list()

Returns a list of valid environment names

invalid_environments_list()

Returns a list of invalid environment names

valid_hosts_list(domain_length=10)

Generates a list of valid host names.

valid_hostgroups_list()

Generates a list of valid host group names.

valid_labels_list()

Generates a list of valid labels.

valid_names_list()

Generates a list of valid names.

valid_org_names_list()

Generates a list of valid organization names.

valid_usernames_list()

Returns a list of valid user names.

valid_interfaces_list()

Generates a list of valid host interface names.

invalid_interfaces_list()

Generates a list of invalid host interface names.

valid_http_credentials(url_encoded=False)

Returns a list of valid credentials for HTTP authentication

invalid_http_credentials(url_encoded=False)

Returns a list of invalid credentials for HTTP authentication

invalid_docker_upstream_names()

Return a list of various kinds of invalid strings for Docker

valid_docker_upstream_names()

Return a list of various kinds of valid strings for Docker repositories.

valid_url_list()

valid_cron_expressions()

Returns a list of valid cron expressions

exception robottelo.datafactory.InvalidArgumentError

Bases: Exception

Indicates an error when an invalid argument is received.

robottelo.datafactory.filtered_datapoint(func)

Overrides the data creator functions in this class to return 1 value and transforms data dictionary to pytest’s parametrize acceptable format for new style generators.

If run_one_datapoint=false, return the entire data set. (default: False) If run_one_datapoint=true, return a random data.

robottelo.datafactory.parametrized(data)

Transforms data dictionary to pytest’s parametrize acceptable format. Generates parametrized test names from data dict keys.

Parameters

data (dict) – dictionary with parametrized test names as dict keys and parametrized arguments as dict values

robottelo.datafactory.generate_strings_list(length=None, exclude_types=None, min_length=3, max_length=30)

Generates a list of different input strings.

Parameters
  • length (int) – Specifies the length of the strings to be be generated. If the len1 is None then the list is returned with string types of random length.

  • exclude_types – Specify a list of data types to be removed from generated list. example: exclude_types=[‘html’, ‘cjk’]

  • min_length (int) – Minimum length to be used in integer generator

  • max_length (int) – Maximum length to be used in integer generator

Returns

A list of various string types.

robottelo.datafactory.add_uppercase_char_into_string(text=None, length=10)

Fix string to include a minimum of one uppercase character. https://github.com/SatelliteQE/robottelo/issues/4742

Parameters
  • text (str) – String to include uppercase character.

  • length (int) – Length of string that we create in case string to change was not provided.

robottelo.datafactory.invalid_emails_list()

Returns a list of invalid emails.

Based on RFC 5321 and 5322, however consecutive dots are removed from the list, as such emails, e.g. email@example..c or dot..dot@example.com are common on the wild and it was decided to treat them as valid.

For more information, see Bugzilla #1455501:.

robottelo.datafactory.invalid_boolean_strings(list_len=10)

Create a list of invalid booleans. E.g not true nor false

Parameters

list_len – len of the list to be generated

Returns

list

robottelo.datafactory.xdist_adapter(argvalues)

Adapter to avoid error when running tests on xdist Check https://github.com/pytest-dev/pytest-xdist/issues/149

It returns a dict with lst as argvalues and range(len(lst)) as ids

Since every run has the same number of values, ids is going to be the same on different workers.

dct = xdist_adapter(invalid_boolean_strings())

@pytest.mark.parametrize('value', **dct)
def test_something(value):
#some code here
Parameters

argvalues – to be passed to parametrize

Returns

dict

robottelo.datafactory.invalid_id_list()

Generates a list of invalid IDs.

robottelo.datafactory.invalid_names_list()

Generates a list of invalid names.

robottelo.datafactory.valid_domain_names(interface=None, length=None)

Valid domain names.

robottelo.datafactory.invalid_domain_names(interface=None)

Invalid domain names.

robottelo.datafactory.invalid_usernames_list()
robottelo.datafactory.invalid_values_list(interface=None)

Generates a list of invalid input values.

This returns invalid values from invalid_names_list() and some interface (api/cli/ui) specific empty string values.

Parameters

interface (str) – Interface name (one of api/cli/ui).

Returns

Returns the invalid values list

Raises

InvalidArgumentError(): If an invalid interface is received.

robottelo.datafactory.valid_data_list(interface=None)

Generates a list of valid input values.

Note: Although this helper is widely used for different attributes for several entities, the following are known behaviors and are handled specifically in the corresponding test modules:

Org - name max length is 242
Loc - name max length is 246
robottelo.datafactory.valid_docker_repository_names()

Generates a list of valid names for Docker repository.

robottelo.datafactory.valid_emails_list()

Returns a list of valid emails.

robottelo.datafactory.valid_environments_list()

Returns a list of valid environment names

robottelo.datafactory.invalid_environments_list()

Returns a list of invalid environment names

robottelo.datafactory.valid_hosts_list(domain_length=10)

Generates a list of valid host names.

Note:: Host name format stored in db is ‘fqdn=’ + host_name + ‘.’ + domain_name Host name max length is: 255 - ‘fqdn=’ - ‘.’ - domain name length (default is 10) = 239 chars (by default). Name should be transformed into lower case

Parameters

domain_length (int) – Domain name length (default is 10).

Returns

Returns the valid host names list

robottelo.datafactory.valid_hostgroups_list()

Generates a list of valid host group names.

Note:: Host group name max length is 245 chars. 220 chars for html as the largest html tag in fauxfactory is 10 chars long, so 245 - (10 chars + 10 chars + ‘<></>’ chars) = 220 chars.

Returns

Returns the valid host group names list

robottelo.datafactory.valid_labels_list()

Generates a list of valid labels.

robottelo.datafactory.valid_names_list()

Generates a list of valid names.

robottelo.datafactory.valid_org_names_list()

Generates a list of valid organization names.

Note:: Organization name max length is 242 chars. 217 chars for html as the largest html tag in fauxfactory is 10 chars long, so 242 - (10 chars + 10 chars + ‘<></>’ chars) = 217 chars.

Returns

Returns the valid organization names list

robottelo.datafactory.valid_usernames_list()

Returns a list of valid user names.

robottelo.datafactory.valid_interfaces_list()

Generates a list of valid host interface names.

robottelo.datafactory.invalid_interfaces_list()

Generates a list of invalid host interface names.

robottelo.datafactory.valid_http_credentials(url_encoded=False)

Returns a list of valid credentials for HTTP authentication The credentials dictionary contains the following keys: login - a username pass - a password quote - a Bool flag stating whether the credentials include special chars http_valid - a Bool flag stating whether the HTTP authentication will pass successfully on the server

Parameters

url_encoded – flag for quoting special characters

Returns

A list of dictionaries with user and password credentials

robottelo.datafactory.invalid_http_credentials(url_encoded=False)

Returns a list of invalid credentials for HTTP authentication

Parameters

url_encoded – flag for quoting special characters

Returns

A list of dictionaries with user and password credentials

robottelo.datafactory.invalid_docker_upstream_names()

Return a list of various kinds of invalid strings for Docker repositories.

robottelo.datafactory.valid_docker_upstream_names()

Return a list of various kinds of valid strings for Docker repositories.

robottelo.datafactory.valid_url_list()
robottelo.datafactory.valid_cron_expressions()

Returns a list of valid cron expressions

robottelo.errors

Custom Errors for Robottelo

Module Contents
exception robottelo.errors.GCECertNotFoundError[source]

Bases: Exception

An exception to raise when GCE Cert json is not available for creating GCE CR

exception robottelo.errors.TemplateNotFoundError[source]

Bases: Exception

An exception to raise when Template is not available in Satellite

robottelo.helpers

Several helper methods and functions.

Module Contents
Classes

ServerFileDownloader

Downloads file from given fileurl to local /temp dirctory.

Storage

Turns a dict into an attribute based object.

Functions

file_downloader(file_url, local_path=None, file_name=None, hostname=None)

Downloads file from given fileurl to directory specified by local_path

get_server_software()

Figure out which product distribution is installed on the server.

get_server_version()

Read Satellite version.

get_host_info(hostname=None)

Get remote host’s distribution information

get_nailgun_config(user=None)

Return a NailGun configuration file constructed from default values.

escape_search(term)

Wraps a search term in ” and escape term’s ” and characters

update_dictionary(default, updates)

Updates default dictionary with elements from

get_data_file(filename)

Returns correct path of file from data folder.

read_data_file(filename)

Read the contents of data file

install_katello_ca(hostname=None, sat_hostname=None)

Downloads and installs katello-ca rpm

remove_katello_ca(hostname=None)

Removes katello-ca rpm

md5_by_url(url, hostname=None)

Returns md5 checksum of a file, accessible via URL. Useful when you want

add_remote_execution_ssh_key(hostname, key_path=None, proxy_hostname=None, **kwargs)

Add remote execution keys to the client

get_available_capsule_port(port_pool=None)

returns a list of unused ports dedicated for fake capsules

default_url_on_new_port(oldport, newport)

Creates context where the default capsule is forwarded on a new port

get_func_name(func, test_item=None)

Given a func object return standardized name to use across project

get_services_status()

Check if core services are running

form_repo_path(org=None, lce=None, cv=None, cvv=None, prod=None, repo=None, capsule=False)

Forms unix path to the directory containing published repository in

create_repo(name, repo_fetch_url=None, packages=None, wipe_repodata=False, hostname=None)

Creates a repository from given packages and publishes it into pulp’s

repo_add_updateinfo(name, updateinfo_url=None, hostname=None)

Modify repo with contents of updateinfo.xml file.

extract_capsule_satellite_installer_command(text)

Extract satellite installer command from capsule-certs-generate command

extract_ui_token(input)

Extracts and returns the CSRF protection token from a given

get_web_session()

Logs in as admin user and returns the valid requests.Session object

host_provisioning_check(ip_addr)

Check the provisioned host status by pinging the ip of host and check

slugify_component(string, keep_hyphens=True)

Make component name a slug

download_gce_cert()

idgen(val)

The id generator function which will return string that will append to the parameterized

Attributes

LOGGER

download_server_file

robottelo.helpers.LOGGER
exception robottelo.helpers.DataFileError

Bases: Exception

Indicates any issue when reading a data file.

exception robottelo.helpers.HostInfoError

Bases: Exception

Indicates any issue when getting host info.

exception robottelo.helpers.ProvisioningCheckError

Bases: Exception

Indicates any issue when provisioning a host.

exception robottelo.helpers.InvalidArgumentError

Bases: Exception

Indicates an error when an invalid argument is received.

exception robottelo.helpers.ProxyError

Bases: Exception

Indicates an error in state of proxy

exception robottelo.helpers.DownloadFileError

Bases: Exception

Indicates an error when failure in downloading file from server.

class robottelo.helpers.ServerFileDownloader

Downloads file from given fileurl to local /temp dirctory.

__call__(self, extention, fileurl)

Downloads file from given fileurl to local /temp directory with given extention.

Parameters
  • extention (str) – The file extention with which the file to be saved in /temp directory.

  • fileurl (str) – The complete server file path from where the file will be downloaded.

Returns

Returns complete file path with name of downloaded file.

robottelo.helpers.download_server_file
robottelo.helpers.file_downloader(file_url, local_path=None, file_name=None, hostname=None)

Downloads file from given fileurl to directory specified by local_path with given file_name on host specified by hostname. Leave hostname as None to download file on the localhost.If remote directory is not specified it downloads file to /tmp/.

Parameters
  • file_url (str) – The complete server file path from where the file will be downloaded.

  • local_path (str) – Name of directory where file will be saved. If not provided file will be saved in /tmp/ directory.

  • file_name (str) – Name of the file to be saved with. If not provided filename from url will be used.

  • hostname (str) – Hostname of server where the file need to be downloaded.

Returns

Returns list containing complete file path and name of downloaded file.

robottelo.helpers.get_server_software()

Figure out which product distribution is installed on the server.

Returns

Either ‘upstream’ or ‘downstream’.

Return type

str

robottelo.helpers.get_server_version()

Read Satellite version.

Inspect server /usr/share/foreman/lib/satellite/version.rb in order to get the installed Satellite version.

Returns

Either a string containing the Satellite version or None if the version.rb file is not present.

robottelo.helpers.get_host_info(hostname=None)

Get remote host’s distribution information

Parameters

hostname (str) – Hostname or IP address of the remote host. If None the hostname will be get from main.server.hostname config.

Returns

A tuple in the form (distro, major, minor). major and minor are integers. minor can be None if not available.

robottelo.helpers.get_nailgun_config(user=None)

Return a NailGun configuration file constructed from default values.

Parameters

user – The `nailgun.entities.User` object of an user with additional passwd property/attribute

Returns

nailgun.config.ServerConfig object, populated from user parameter object else with values from robottelo.config.settings

Wraps a search term in ” and escape term’s ” and characters

robottelo.helpers.update_dictionary(default, updates)

Updates default dictionary with elements from optional dictionary.

@param default: A python dictionary containing the minimal required arguments to create a CLI object. @param updates: A python dictionary containing attributes to overwrite on default dictionary.

@return default: The modified default python dictionary.

robottelo.helpers.get_data_file(filename)

Returns correct path of file from data folder.

robottelo.helpers.read_data_file(filename)

Read the contents of data file

robottelo.helpers.install_katello_ca(hostname=None, sat_hostname=None)

Downloads and installs katello-ca rpm

Parameters

hostname (str) – Hostname or IP address of the remote host. If None the hostname will be get from main.server.hostname config

Returns

None.

Raises

AssertionError: If katello-ca wasn’t installed.

robottelo.helpers.remove_katello_ca(hostname=None)

Removes katello-ca rpm

Parameters

hostname (str) – Hostname or IP address of the remote host. If None the hostname will be get from main.server.hostname config

Returns

None.

Raises

AssertionError: If katello-ca wasn’t removed.

robottelo.helpers.md5_by_url(url, hostname=None)

Returns md5 checksum of a file, accessible via URL. Useful when you want to calculate checksum but don’t want to deal with storing a file and removing it afterwards.

Parameters
  • url (str) – URL of a file.

  • hostname (str) – Hostname or IP address of the remote host. If None the hostname will be get from main.server.hostname config

Return str

string containing md5 checksum.

Raises

AssertionError: If non-zero return code received (file couldn’t be reached or calculation was not successful).

robottelo.helpers.add_remote_execution_ssh_key(hostname, key_path=None, proxy_hostname=None, **kwargs)

Add remote execution keys to the client

Parameters
  • proxy_hostname (str) – external capsule hostname

  • hostname (str) – The client hostname

  • key (str) – Path to a key on the satellite server

  • kwargs (dict) – directly passed to ssh.add_authorized_key

robottelo.helpers.get_available_capsule_port(port_pool=None)

returns a list of unused ports dedicated for fake capsules This calls an ss command on the server prompting for a port range. ss returns a list of ports which have a PID assigned (a list of ports which are already used). This function then substracts unavailable ports from the other ones and returns one of available ones randomly.

Parameters

port_pool – A list of ports used for fake capsules (for RHEL7+: don’t forget to set a correct selinux context before otherwise you’ll get Connection Refused error)

Returns

Random available port from interval <9091, 9190>.

Return type

int

robottelo.helpers.default_url_on_new_port(oldport, newport)

Creates context where the default capsule is forwarded on a new port

Parameters
  • oldport (int) – Port to be forwarded.

  • newport (int) – New port to be used to forward oldport.

Returns

A string containing the new capsule URL with port.

Return type

str

class robottelo.helpers.Storage(*args, **kwargs)

Turns a dict into an attribute based object.

Example:

d = {'foo': 'bar'}
d['foo'] == 'bar'
storage = Storage(d)
storage.foo == 'bar'
robottelo.helpers.get_func_name(func, test_item=None)

Given a func object return standardized name to use across project

robottelo.helpers.get_services_status()

Check if core services are running

robottelo.helpers.form_repo_path(org=None, lce=None, cv=None, cvv=None, prod=None, repo=None, capsule=False)

Forms unix path to the directory containing published repository in pulp using provided entity names. Supports both repositories in content view version and repositories in lifecycle environment. Note that either cvv or lce is required.

Parameters
  • org (str) – organization label

  • optional lce (str) – lifecycle environment label

  • cv (str) – content view label

  • optional cvv (str) – content view version, e.g. ‘1.0’

  • prod (str) – product label

  • repo (str) – repository label

  • capsule (bool) – whether the repo_path is from a capsule or not

Returns

full unix path to the specific repository

Return type

str

robottelo.helpers.create_repo(name, repo_fetch_url=None, packages=None, wipe_repodata=False, hostname=None)

Creates a repository from given packages and publishes it into pulp’s directory for web access.

Parameters
  • name (str) – repository name - name of a directory with packages

  • repo_fetch_url (str) – URL to fetch packages from

  • packages – list of packages to fetch (with extension)

  • wipe_repodata – whether to recursively delete repodata folder

  • optional hostname (str) – hostname or IP address of the remote host. If None the hostname will be get from main.server.hostname config.

Returns

URL where the repository can be accessed

Return type

str

robottelo.helpers.repo_add_updateinfo(name, updateinfo_url=None, hostname=None)

Modify repo with contents of updateinfo.xml file.

Parameters
  • name (str) – repository name

  • optional updateinfo_url (str) – URL to download updateinfo.xml file from. If not specified - updateinfo.xml from repository folder will be used instead

  • optional hostname (str) – hostname or IP address of the remote host. If None the hostname will be get from main.server.hostname config.

Returns

result of executing modifyrepo command

robottelo.helpers.extract_capsule_satellite_installer_command(text)

Extract satellite installer command from capsule-certs-generate command output

robottelo.helpers.extract_ui_token(input)

Extracts and returns the CSRF protection token from a given HTML string

robottelo.helpers.get_web_session()

Logs in as admin user and returns the valid requests.Session object

robottelo.helpers.host_provisioning_check(ip_addr)

Check the provisioned host status by pinging the ip of host and check to connect to ssh port

Parameters

ip_addr – IP address of the provisioned host

Returns

ssh command return code and stdout

robottelo.helpers.slugify_component(string, keep_hyphens=True)

Make component name a slug

Arguments:

string {str} – Component name e.g: ActivationKeys keep_hyphens {bool} – Keep hyphens or replace with underscores

Returns:

str – component slug e.g: activationkeys

robottelo.helpers.download_gce_cert()
robottelo.helpers.idgen(val)

The id generator function which will return string that will append to the parameterized test name

robottelo.host_info

Module that gather several informations about host

Module Contents
Classes

SatVersionDependentValues

Class which return values depending on Satellite host version

Functions

get_host_os_version()

Fetches host’s OS version through SSH

get_host_sat_version()

Fetches host’s Satellite version through SSH

_extract_sat_version(ssh_cmd)

Extracts Satellite version if possible or ‘Not Available’ otherwise

get_repo_files(repo_path, extension='rpm', hostname=None)

Returns a list of repo files (for example rpms) in specific repository

get_repomd_revision(repo_path, hostname=None)

Fetches a revision of repository.

get_sat_version()

Try to read sat_version from envvar SATELLITE_VERSION

Attributes

LOGGER

_SAT_6_2_VERSION_COMMAND

_SAT_6_1_VERSION_COMMAND

robottelo.host_info.LOGGER
robottelo.host_info.get_host_os_version()

Fetches host’s OS version through SSH :return: str with version

robottelo.host_info._SAT_6_2_VERSION_COMMAND = rpm -q satellite
robottelo.host_info._SAT_6_1_VERSION_COMMAND = grep "VERSION" /usr/share/foreman/lib/satellite/version.rb
robottelo.host_info.get_host_sat_version()

Fetches host’s Satellite version through SSH :return: Satellite version :rtype: version

robottelo.host_info._extract_sat_version(ssh_cmd)

Extracts Satellite version if possible or ‘Not Available’ otherwise

Parameters

ssh_cmd – str ssh command

Returns

Satellite version

Return type

str

robottelo.host_info.get_repo_files(repo_path, extension='rpm', hostname=None)

Returns a list of repo files (for example rpms) in specific repository directory.

Parameters
  • repo_path (str) – unix path to the repo, e.g. ‘/var/lib/pulp/fooRepo/’

  • extension (str) – extension of searched files. Defaults to ‘rpm’

  • optional hostname (str) – hostname or IP address of the remote host. If None the hostname will be get from main.server.hostname config.

Returns

list representing rpm package names

Return type

list

robottelo.host_info.get_repomd_revision(repo_path, hostname=None)

Fetches a revision of repository.

Parameters
  • repo_path (str) – unix path to the repo, e.g. ‘/var/lib/pulp/fooRepo’

  • optional hostname (str) – hostname or IP address of the remote host. If None the hostname will be get from main.server.hostname config.

Returns

string containing repository revision

Return type

str

class robottelo.host_info.SatVersionDependentValues(*dcts, **kwargs)

Class which return values depending on Satellite host version

__getitem__(self, item)

Return value dependent on Satellite version :param item: str :return: respective Satellite version values

robottelo.host_info.get_sat_version()

Try to read sat_version from envvar SATELLITE_VERSION if not available fallback to ssh connection to get it.

robottelo.hosts
Module Contents
Classes

ContentHost

Capsule

Satellite

Functions

setup_capsule(satellite, capsule, registration_args=None, installation_args=None)

Given satellite and capsule instances, run the commands needed to set up the capsule

Attributes

logger

robottelo.hosts.logger
robottelo.hosts.setup_capsule(satellite, capsule, registration_args=None, installation_args=None)

Given satellite and capsule instances, run the commands needed to set up the capsule

Note: This does not perform content setup actions on the Satellite

Parameters
  • satellite – An instance of this module’s Satellite class

  • capsule – An instance of this module’s Capsule class

  • registration_args – A dictionary mapping argument: value pairs for registration

  • installation_args – A dictionary mapping argument: value pairs for installation

Returns

An ssh2-python result object for the installation command.

exception robottelo.hosts.ContentHostError

Bases: Exception

Common base class for all non-exit exceptions.

class robottelo.hosts.ContentHost

Bases: broker.hosts.Host

run
subscribed = False
property nailgun_host(self)

If this host is subscribed, provide access ot its nailgun object

property subscribed(self)

Boolean representation of a content host’s subscription status

property ip_addr(self)
download_install_rpm(self, repo_url, package_name)

Downloads and installs custom rpm on the broker virtual machine.

Parameters
  • repo_url – URL to repository, where package is located.

  • package_name – Desired package name.

Returns

None.

Raises

robottelo.hosts.ContentHostError – If package wasn’t installed.

enable_repo(self, repo, force=False)

Enables specified Red Hat repository on the broker virtual machine. Does nothing if downstream capsule or satellite tools repo was passed. Custom repos are enabled by default when registering a host.

Parameters
  • repo – Red Hat repository name.

  • force – enforce enabling command, even when custom repos are detected for satellite tools or capsule.

Returns

None.

subscription_manager_list_repos(self)
subscription_manager_status(self)
subscription_manager_list(self)
create_custom_repos(self, **kwargs)

Create custom repofiles. Each kwargs item will result in one repository file created. Where the key is the repository filename and repository name, and the value is the repository URL.

For example:

create_custom_repo(custom_repo='http://repourl.domain.com/path')

Will create a repository file named custom_repo.repo with the following contents:

[custom_repo]
name=custom_repo
baseurl=http://repourl.domain.com/path
enabled=1
gpgcheck=0
install_katello_agent(self)

Install katello-agent on the virtual machine.

Returns

None.

Raises

ContentHostError – if katello-agent is not installed.

install_katello_host_tools(self)

Installs Katello host tools on the broker virtual machine

Raises

robottelo.hosts.ContentHostError – If katello-host-tools wasn’t installed.

install_katello_ca(self, sat_hostname=None)

Downloads and installs katello-ca rpm on the broker virtual machine.

Uses common helper install_katello_ca(hostname=None), but passes self.hostname instead of the hostname as we are using fake hostnames for broker virtual machines.

Returns

None.

Raises

robottelo.hosts.ContentHostError – If katello-ca wasn’t installed.

install_capsule_katello_ca(self, capsule=None)

Downloads and installs katello-ca rpm on the broker virtual machine.

Param

str capsule: Capsule hostname

Raises

robottelo.hosts.ContentHostError – If katello-ca wasn’t installed.

register_contenthost(self, org='Default_Organization', activation_key=None, lce='Library', consumerid=None, force=True, releasever=None, username=None, password=None, auto_attach=False)

Registers content host on foreman server either by specifying organization name and activation key name or by specifying organization name and lifecycle environment name (administrator credentials for authentication will be passed automatically).

Parameters
  • activation_key – Activation key name to register content host with.

  • lce – lifecycle environment name to which register the content host.

  • consumerid – uuid of content host, register to this content host, content host has to be created before

  • org – Organization name to register content host for.

  • force – Register the content host even if it’s already registered

  • releasever – Set a release version

  • username – a user name to register the content host with

  • password – the user password

  • auto_attach – automatically attach compatible subscriptions to this system.

Returns

SSHCommandResult instance filled with the result of the registration.

remove_katello_ca(self, capsule=None)

Removes katello-ca rpm from the broker virtual machine.

Param

str capsule: (optional) Capsule hostname

Returns

None.

Raises

robottelo.hosts.ContentHostError – If katello-ca wasn’t removed.

unregister(self)

Run subscription-manager unregister.

Returns

SSHCommandResult instance filled with the result of the unregistration.

get(self, remote_path, local_path=None)

Get a remote file from the broker virtual machine.

put(self, local_path, remote_path=None)

Put a local file to the broker virtual machine.

configure_rhel_repo(self, rhel_repo)

Configures specified Red Hat repository on the broker virtual machine.

Parameters

rhel_repo – Red Hat repository link from properties file.

Returns

None.

configure_puppet(self, rhel_repo=None, proxy_hostname=None)

Configures puppet on the virtual machine/Host. :param proxy_hostname: external capsule hostname :param rhel_repo: Red Hat repository link from properties file. :return: None.

execute_foreman_scap_client(self, policy_id=None)

Executes foreman_scap_client on the vm to create security audit report.

Parameters

policy_id – The Id of the OSCAP policy.

Returns

None.

configure_rhai_client(self, activation_key, org, rhel_distro, register=True)

Configures a Red Hat Access Insights service on the system by installing the redhat-access-insights package and registering to the service.

Parameters
  • activation_key – Activation key to be used to register the system to satellite

  • org – The org to which the system is required to be registered

  • rhel_distro – rhel distribution used by the vm

  • register – Whether to register client to insights

Returns

None

unregister_insights(self)

Unregister insights client.

Returns

None

set_infrastructure_type(self, infrastructure_type='physical')

Force host to appear as bare-metal orbroker virtual machine in subscription-manager fact.

Parameters

infrastructure_type (str) – One of ‘physical’, ‘virtual’

patch_os_release_version(self, distro=DISTRO_RHEL7)

Patch VM OS release version.

This is needed by yum package manager to generate the right RH repositories urls.

class robottelo.hosts.Capsule

Bases: ContentHost

restart_services(self)

Restart services, returning True if passed and stdout if not

check_services(self)
install(self, **cmd_kwargs)

General purpose installer

class robottelo.hosts.Satellite(*args, **kwargs)

Bases: Capsule

_init_nailgun(self)

Import all nailgun entities and wrap them under self.api

_init_cli(self)

Import all robottelo cli entities and wrap them under self.cli

_init_airgun(self)

Initialize an airgun Session object and store it as self.ui_session

version(self)
capsule_certs_generate(self, capsule, **extra_kwargs)

Generate capsule certs, returning the cert path and the installer command args

robottelo.libvirt_discovery

Utilities to create virtual host on libvirt with and without PXE boot

Hosts are virtual guests provisioned on a external libvirt_host. All guests images are stored on the image_dir path on external libvirt server.

Make sure to configure the compute_resources section on the configuration file. Also make sure that the vlan_networking section is properly configured.

Module Contents
Classes

LibvirtGuest

Manages a Libvirt guests to allow host discovery and provisioning

Functions

_gen_mac_for_libvirt()

Attributes

logger

robottelo.libvirt_discovery.logger
robottelo.libvirt_discovery._gen_mac_for_libvirt()
exception robottelo.libvirt_discovery.LibvirtGuestError

Bases: Exception

Exception raised for failed virtual guests on external libvirt

class robottelo.libvirt_discovery.LibvirtGuest(cpu=1, ram=1024, boot_iso=False, extra_nic=False, libvirt_server=None, image_dir=None, mac=None, network=None, network_type=None)

Manages a Libvirt guests to allow host discovery and provisioning

It expects that Libvirt host is defined with image path. Make sure to call destroy() to stop and clean the image on the libvirt server, otherwise the virtual machine and its image will stay on the server consuming hardware resources.

It is possible to customize the libvirt_host and image_dir as per virtual machine basis. Just set the expected values when instantiating.

create(self)

Creates a virtual machine on the libvirt server using virt-install

Raises

robottelo.libvirt_discovery.LibvirtGuestError – Whenever a virtual guest could not be executed.

destroy(self)

Destroys the virtual machine on the provisioning server

attach_nic(self)

Add a new NIC to existing host

__enter__(self)
__exit__(self, *exc)
robottelo.log

Utilities to help work with log files

Module Contents
Classes

LogFile

References a remote log file. The log file will be downloaded to allow

Attributes

LOGS_DATA_DIR

robottelo.log.LOGS_DATA_DIR
class robottelo.log.LogFile(remote_path, pattern=None)

References a remote log file. The log file will be downloaded to allow operate on it using python

filter(self, pattern=None)

Filter the log file using the pattern argument or object’s pattern

robottelo.manifests

Manifest clonning tools..

Module Contents
Classes

ManifestCloner

Manifest clonning utility class.

Manifest

Class that holds the contents of a manifest with a generated filename

Functions

clone(org_environment_access=False, name='default')

Clone the cached manifest and return a Manifest object.

original_manifest(name='default')

Returns a Manifest object filed with the template manifest.

upload_manifest_locked(org_id, manifest=None, interface=INTERFACE_API, timeout=None)

Upload a manifest with locking, using the requested interface.

Attributes

_manifest_cloner

class robottelo.manifests.ManifestCloner(template=None, private_key=None, signing_key=None)

Manifest clonning utility class.

_download_manifest_info(self, name='default')

Download and cache the manifest information.

clone(self, org_environment_access=False, name='default')

Clones a RedHat-manifest file.

Change the consumer uuid and sign the new manifest with signing key. The certificate for the key must be installed on the candlepin server in order to accept uploading the cloned manifest.

Parameters
  • org_environment_access – Whether to modify consumer content access mode to org_environment (Golden ticket enabled manifest).

  • name – which manifest url to clone (named key-value pairs are defined as fake_manifest.url value in robottelo.properties (default: ‘default’)

Returns

A file-like object (BytesIO on Python 3 and StringIO on Python 2) with the contents of the cloned manifest.

original(self, name='default')

Returns the original manifest as a file-like object.

Parameters

name – A name of the manifest as defined in robottelo.properties

Be aware that using the original manifest and not removing it afterwards will make it impossible to import it to any other Organization.

Make sure to close the returned file-like object in order to clean up the memory used to store it.

robottelo.manifests._manifest_cloner
class robottelo.manifests.Manifest(content=None, filename=None, org_environment_access=False, name='default')

Class that holds the contents of a manifest with a generated filename based on time.time.

To ensure that the manifest content is closed use this class as a context manager with the with statement:

with Manifest() as manifest:
    # my fancy stuff
property content(self)
__enter__(self)
__exit__(self, type, value, traceback)
robottelo.manifests.clone(org_environment_access=False, name='default')

Clone the cached manifest and return a Manifest object.

Parameters
  • org_environment_access – Whether to modify consumer content access mode to org_environment (Golden ticket enabled manifest).

  • name – key name of the fake_manifests.url dict defined in robottelo.properties

Is hightly recommended to use this with the with statement to make that the content of the manifest (file-like object) is closed properly:

with clone() as manifest:
    # my fancy stuff
robottelo.manifests.original_manifest(name='default')

Returns a Manifest object filed with the template manifest.

Parameters

name – key name of the fake_manifests.url dict defined in robottelo.properties

Make sure to remove the manifest after its usage otherwiser the Satellite 6 server will not accept it anymore on any other organization.

Is hightly recommended to use this with the with statement to make that the content of the manifest (file-like object) is closed properly:

with original_manifest() as manifest:
    # my fancy stuff
robottelo.manifests.upload_manifest_locked(org_id, manifest=None, interface=INTERFACE_API, timeout=None)

Upload a manifest with locking, using the requested interface.

Returns

the upload result

Note: The manifest uploading is strictly locked only when using this

function

Usage:

# for API interface
manifest = manifests.clone()
upload_manifest_locked(org_id, manifest, interface=INTERFACE_API)

# for CLI interface
manifest = manifests.clone()
upload_manifest_locked(org_id, manifest, interface=INTERFACE_CLI)

# or in one line with default interface
result = upload_manifest_locked(org_id, manifests.clone())
subscription_id = result[id']
robottelo.products

Manage RH products repositories and custom repositories.

The main purpose of this feature is to manage product repositories especially the RH one in the context of a special distro and cdn settings.

The repository data creation became transparent when supplying only the target distro.

Example Usage:

We know that sat tool key = ‘rhst’

Working with generic repos.

Generic repos has no way to guess the custom repo url in case of settings.cdn = false , that why the GenericRHRepo without custom url always return cdn repo data:

sat_repo = GenericRHRepository(key=PRODUCT_KEY_SAT_TOOLS)
print(sat_repo.cdn) >> True
# today the default distro is rhel7
print(sat_repo.distro)  >> rhel7
print(sat_repo.data) >>
{
'arch': 'x86_64',
'cdn': True,
'product': 'Red Hat Enterprise Linux Server',
'releasever': None,
'repository': 'Red Hat Satellite Tools 6.2 for RHEL 7 Server RPMs x86_64',
'repository-id': 'rhel-7-server-satellite-tools-6.2-rpms',
'repository-set': 'Red Hat Satellite Tools 6.2 (for RHEL 7 Server) (RPMs)'
}

# Generic CDN RH repository with specific distro "DISTRO_RHEL6"
sat_repo = GenericRHRepository(
    distro=DISTRO_RHEL6, key=PRODUCT_KEY_SAT_TOOLS)

print(sat_repo.distro) >> rhel6
print(sat_repo.data)   >>
{
'arch': 'x86_64',
'cdn': True,
'product': 'Red Hat Enterprise Linux Server',
'releasever': None,
'repository': 'Red Hat Satellite Tools 6.2 for RHEL 6 Server RPMs x86_64',
'repository-id': 'rhel-6-server-satellite-tools-6.2-rpms',
'repository-set': 'Red Hat Satellite Tools 6.2 (for RHEL 6 Server) (RPMs)'
}

# Generic RH repository with custom url
sat_repo = GenericRHRepository(
    key=PRODUCT_KEY_SAT_TOOLS, url='http://sat-tools.example.com')

# because default settings.cdn=False and we have a custom url
print(sat_repo.cdn) >> False
print(sat_repo.distro) >> rhel7
print(sat_repo.data) >>
{'cdn': False, 'url': 'http://sat-tools.example.com'}

# Generic RH repository with custom url and force cdn
sat_repo = GenericRHRepository(
    key=PRODUCT_KEY_SAT_TOOLS,
    url='http://sat-tools.example.com',
    cdn=True
)
print(sat_repo.data) >>
{
'arch': 'x86_64',
'cdn': True,
'product': 'Red Hat Enterprise Linux Server',
'releasever': None,
'repository': 'Red Hat Satellite Tools 6.2 for RHEL 7 Server RPMs x86_64',
'repository-id': 'rhel-7-server-satellite-tools-6.2-rpms',
'repository-set': 'Red Hat Satellite Tools 6.2 (for RHEL 7 Server) (RPMs)'
}

# We have created a SatelliteToolsRepository that automatically detect it's
# custom url in settings, so there no need to explicitly initialise with
# url, simply the distro is needed (in case of specific one), otherwise
# the default distro will be used.

# SatelliteToolsRepository RH repo use settings urls and cdn
sat_repo = SatelliteToolsRepository()
print(sat_repo.cdn) >> False
print(sat_repo.distro) >> rhel7
print(sat_repo.data) >>
{
'cdn': False,
# part of the url was hidden
'url': 'XXXXXXXXXXXXXXXXXXX/Tools_6_3_RHEL7/custom/'
       'Satellite_Tools_6_3_Composes/Satellite_Tools_x86_64/'
}

# SatelliteToolsRepository RH repo use settings urls with 'force cdn')
sat_repo = SatelliteToolsRepository(cdn=True)
print(sat_repo.cdn >> True
print(sat_repo.distro >> rhel7
print(sat_repo.data >>
{
'arch': 'x86_64',
'cdn': True,
'product': 'Red Hat Enterprise Linux Server',
'releasever': None,
'repository': 'Red Hat Satellite Tools 6.2 for RHEL 7 Server RPMs x86_64',
'repository-id': 'rhel-7-server-satellite-tools-6.2-rpms',
'repository-set': 'Red Hat Satellite Tools 6.2 (for RHEL 7 Server) (RPMs)'
}

# we can also indicate the distro, the same as for the generic one the
# data will be switched for that distro


# Working with RepositoryCollection using the default distro
repos_collection = RepositoryCollection(
    repositories=[
        RHELRepository(),
        SatelliteToolsRepository(),
        SatelliteCapsuleRepository(),
        CustomYumRepository(url=FAKE_0_YUM_REPO)
    ]
)

repos_collection.distro >> None
repos_collection.repos_data >>
[{'cdn': False,
  'url': 'http://XXXXXXXXX/RHEL-7/7.4/Server/x86_64/os/'},
 {'cdn': False,
  'url': 'http://XXXXXXXXXXX/Tools_6_3_RHEL7/custom/'
         'Satellite_Tools_6_3_Composes/Satellite_Tools_x86_64/'
         },
 {'cdn': False,
  'url': 'http://XXXXXXXXXX/Satellite_6_3_RHEL7/custom/'
         'Satellite_6_3_Composes/Satellite_6_3_RHEL7'
         },
 {'cdn': False, 'url': 'http://inecas.fedorapeople.org/fakerepos/zoo/'}
]
repos_collection.need_subscription >> False

# Working with RepositoryCollection with force distro RHEL6 and force cdn
# on some repos
repos_collection = RepositoryCollection(
    distro=DISTRO_RHEL6,
    repositories=[
        SatelliteToolsRepository(cdn=True),
        SatelliteCapsuleRepository(),
        YumRepository(url=FAKE_0_YUM_REPO)
    ]
)
repos_collection.distro >> rhel6
repos_collection.repos_data >>
[
    {'arch': 'x86_64',
     'cdn': True,
     'product': 'Red Hat Enterprise Linux Server',
     'releasever': None,
     'repository': 'Red Hat Satellite Tools 6.2 for RHEL 6 Server RPMs'
                   ' x86_64',
     'repository-id': 'rhel-6-server-satellite-tools-6.2-rpms',
     'repository-set': 'Red Hat Satellite Tools 6.2 (for RHEL 6 Server)
                       '(RPMs)'
    },
    {
    'arch': 'x86_64',
    'cdn': True,
    'product': 'Red Hat Satellite Capsule',
    'releasever': None,
    'repository': 'Red Hat Satellite Capsule 6.2 for RHEL 6 Server RPMs '
                  'x86_64',
    'repository-id': 'rhel-6-server-satellite-capsule-6.2-rpms',
    'repository-set': 'Red Hat Satellite Capsule 6.2 (for RHEL 6 Server) '
                      '(RPMs)'
    },
    {'cdn': False, 'url': 'http://inecas.fedorapeople.org/fakerepos/zoo/'}
]
repos_collection.need_subscription >> True
# Note: satellite capsule repo will query the server for a distro and if
# the same distro as the sat server is used will use the settings url
# (if cdn=False) else it will use the cdn one.

# Please consult the RepositoryCollection for some usage functions
# also test usage located at:
# tests/foreman/cli/test_vm_install_products_package.py
Module Contents
Classes

BaseRepository

Base repository class for custom and RH repositories

YumRepository

Custom Yum repository

DockerRepository

Custom Docker repository

PuppetRepository

Custom Puppet repository

OSTreeRepository

Custom OSTree repository

GenericRHRepository

Generic RH repository

RHELRepository

RHEL repository

SatelliteToolsRepository

Satellite Tools Repository

SatelliteCapsuleRepository

Satellite capsule repository

VirtualizationAgentsRepository

Virtualization Agents repository

RHELCloudFormsTools

Generic RH repository

RHELAnsibleEngineRepository

Red Hat Ansible Engine Repository

RepositoryCollection

Repository collection

Functions

get_server_distro() → str

Attributes

REPO_TYPE_YUM

REPO_TYPE_DOCKER

REPO_TYPE_PUPPET

REPO_TYPE_OSTREE

DOWNLOAD_POLICY_ON_DEMAND

DOWNLOAD_POLICY_IMMEDIATE

DOWNLOAD_POLICY_BACKGROUND

PRODUCT_KEY_RHEL

PRODUCT_KEY_SAT_TOOLS

PRODUCT_KEY_SAT_CAPSULE

PRODUCT_KEY_VIRT_AGENTS

PRODUCT_KEY_CLOUD_FORMS_TOOLS

PRODUCT_KEY_ANSIBLE_ENGINE

_server_distro

robottelo.products.REPO_TYPE_YUM
robottelo.products.REPO_TYPE_DOCKER
robottelo.products.REPO_TYPE_PUPPET
robottelo.products.REPO_TYPE_OSTREE
robottelo.products.DOWNLOAD_POLICY_ON_DEMAND = on_demand
robottelo.products.DOWNLOAD_POLICY_IMMEDIATE = immediate
robottelo.products.DOWNLOAD_POLICY_BACKGROUND = background
robottelo.products.PRODUCT_KEY_RHEL = rhel
robottelo.products.PRODUCT_KEY_SAT_TOOLS = rhst
robottelo.products.PRODUCT_KEY_SAT_CAPSULE = rhsc
robottelo.products.PRODUCT_KEY_VIRT_AGENTS = rhva6
robottelo.products.PRODUCT_KEY_CLOUD_FORMS_TOOLS = rhct6
robottelo.products.PRODUCT_KEY_ANSIBLE_ENGINE = rhae2
robottelo.products._server_distro :str
exception robottelo.products.RepositoryAlreadyDefinedError

Bases: Exception

Raised when a repository has already a predefined key

exception robottelo.products.DistroNotSupportedError

Bases: Exception

Raised when using a non supported distro

exception robottelo.products.RepositoryDataNotFound

Bases: Exception

Raised when repository data cannot be found for a predefined distro

exception robottelo.products.OnlyOneOSRepositoryAllowed

Bases: Exception

Raised when trying to more than one OS repository to a collection

exception robottelo.products.RepositoryAlreadyCreated

Bases: Exception

Raised when a repository content is already created and trying to launch the create an other time

exception robottelo.products.ReposContentSetupWasNotPerformed

Bases: Exception

Raised when trying to setup a VM but the repositories content was not setup

robottelo.products.get_server_distro()str
class robottelo.products.BaseRepository(url=None, distro=None, content_type=None)

Base repository class for custom and RH repositories

_url :Optional[str]
_distro :Optional[str]
_type :Optional[str]
_repo_info :Optional[Dict]
property url(self)Optional[str]
property cdn(self)bool
property data(self)Dict
property distro(self)Optional[str]

Return the current distro

property content_type(self)str
__repr__(self)

Return repr(self).

property repo_info(self)Optional[Dict]
create(self: int, organization_id: int, product_id: str, download_policy: bool = DOWNLOAD_POLICY_ON_DEMAND, synchronize=True)Dict

Create the repository for the supplied product id

synchronize(self)

Synchronize the repository

add_to_content_view(self: int, organization_id: int, content_view_id)None

Associate repository content to content-view

class robottelo.products.YumRepository(url=None, distro=None, content_type=None)

Bases: BaseRepository

Custom Yum repository

_type :str
class robottelo.products.DockerRepository(url=None, distro=None, upstream_name=None)

Bases: BaseRepository

Custom Docker repository

_type :str
property upstream_name(self)
create(self, organization_id, product_id, download_policy=None, synchronize=True)

Create the repository for the supplied product id

class robottelo.products.PuppetRepository(: str, url: Optional[str] = None, distro: List[Dict[str, str]] = None, modules=None)

Bases: BaseRepository

Custom Puppet repository

_type :str
property puppet_modules(self)
add_to_content_view(self: int, organization_id: int, content_view_id)None

Associate repository content to content-view

class robottelo.products.OSTreeRepository(url=None, distro=None, content_type=None)

Bases: BaseRepository

Custom OSTree repository

_type
class robottelo.products.GenericRHRepository(distro=None, key=None, cdn=False, url=None)

Bases: BaseRepository

Generic RH repository

_type
_distro :str
_key :str
_repo_data :Dict
_url :Optional[str]
property url(self)
property cdn(self)
property key(self)
property distro(self)

Return the current distro

_get_repo_data(self: Optional[str], distro=None)Dict

Return the repo data as registered in constant module and bound to distro.

property repo_data(self)Dict
_repo_is_distro(self: Optional[Dict], repo_data=None)bool

return whether the repo data is for an OS distro product repository

property is_distro_repository(self)bool
property distro_major_version(self)
property distro_repository(self)Optional[RHELRepository]

Return the OS distro repository object relied to this repository

Suppose we have a repository for a product that must be installed on RHEL, but for proper installation needs some dependencies packages from the OS repository. This function will return the right OS repository object for later setup.

for example:

capsule_repo = SatelliteCapsuleRepository() # the capsule_repo will represent a capsule repo for default distro rhel_repo = capsule_repo.distro_repository # the rhel repo representation object for default distro will be # returned, if not found raise exception

property rh_repository_id(self)Optional[str]
property data(self)Dict
__repr__(self)

Return repr(self).

create(self: int, organization_id: Optional[int], product_id: Optional[str] = None, download_policy: Optional[bool] = DOWNLOAD_POLICY_ON_DEMAND, synchronize=True)Dict

Create an RH repository

class robottelo.products.RHELRepository(distro=None, key=None, cdn=False, url=None)

Bases: GenericRHRepository

RHEL repository

_key
property url(self)
class robottelo.products.SatelliteToolsRepository(distro=None, key=None, cdn=False, url=None)

Bases: GenericRHRepository

Satellite Tools Repository

_key
property url(self)
class robottelo.products.SatelliteCapsuleRepository(distro=None, key=None, cdn=False, url=None)

Bases: GenericRHRepository

Satellite capsule repository

_key
property url(self)
class robottelo.products.VirtualizationAgentsRepository(distro=None, key=None, cdn=False, url=None)

Bases: GenericRHRepository

Virtualization Agents repository

_key
_distro
class robottelo.products.RHELCloudFormsTools(distro=None, key=None, cdn=False, url=None)

Bases: GenericRHRepository

Generic RH repository

_distro
_key
class robottelo.products.RHELAnsibleEngineRepository(distro=None, key=None, cdn=False, url=None)

Bases: GenericRHRepository

Red Hat Ansible Engine Repository

_key
class robottelo.products.RepositoryCollection(distro=None, repositories=None)

Repository collection

_distro :str
_org :Dict
_items :List[BaseRepository] = []
_repos_info :List[Dict] = []
_custom_product_info :Dict
_os_repo :RHELRepository
_setup_content_data :Dict[str, Dict]
property distro(self)str
property repos_info(self)List[Dict]
property custom_product(self)
property os_repo(self)RHELRepository
property repos_data(self)List[Dict]
property rh_repos(self)List[BaseRepository]
property custom_repos(self)List[BaseRepository]
property rh_repos_info(self)List[Dict]
property custom_repos_info(self)List[Dict]
property setup_content_data(self)
property need_subscription(self)bool
property organization(self)
add_item(self, item)None

Add repository to collection

Parameters

item (BaseRepository) – Item to add

Returns

None

add_items(self, items)

Add multiple repositories to collection

Parameters

items (List[BaseRepository]) – Items to add

Returns

None

__iter__(self)
setup(self: int, org_id: str, download_policy: bool = DOWNLOAD_POLICY_ON_DEMAND, synchronize=True)Tuple[Dict, List[Dict]]

Setup the repositories on server.

Recommended usage: repository only setup, for full content setup see

setup_content.

setup_content_view(self: int, org_id: int, lce_id=None)Tuple[Dict, Dict]

Setup organization content view by adding all the repositories, publishing and promoting to lce if needed.

static setup_activation_key(org_id: int, content_view_id: int, lce_id: int, subscription_names: Optional[List[str]] = None)Dict

Create activation and associate content-view, lifecycle environment and subscriptions

static organization_has_manifest(organization_id)

Check if an organization has a manifest, an organization has manifest if one of it’s subscriptions have the account defined.

setup_content(self: int, org_id: int, lce_id: bool, upload_manifest: str = False, download_policy: Optional[List[str]] = DOWNLOAD_POLICY_ON_DEMAND, rh_subscriptions=None)Dict[str, Any]

Setup content view and activation key of all the repositories.

Parameters
  • org_id – The organization id

  • lce_id – The lifecycle environment id

  • upload_manifest – Whether to upload the manifest (The manifest is uploaded only if needed)

  • download_policy – The repositories download policy

  • rh_subscriptions – The RH subscriptions to be added to activation key

setup_virtual_machine(self, vm, patch_os_release=False, install_katello_agent=True, enable_rh_repos=True, enable_custom_repos=False, configure_rhel_repo=False)

Setup The virtual machine basic task, eg: install katello ca, register vm host, enable rh repos and install katello-agent

Parameters
  • vm (VirtualMachine) – The Virtual machine to setup.

  • patch_os_release (bool) – whether to patch the VM with os version.

  • install_katello_agent (bool) – whether to install katello-agent

  • enable_rh_repos (bool) – whether to enable RH repositories

  • enable_custom_repos (bool) – whether to enable custom repositories

  • configure_rhel_repo (bool) – Whether to configure the distro Red Hat repository, this is needed to configure manually RHEL custom repo url as sync time is very big (more than 2 hours for RHEL 7Server) and not critical for some contexts.

robottelo.rh_cloud_utils

Utility module for RH cloud inventory tests

Module Contents
Functions

get_host_counts(tarobj)

Returns hosts count from tar file.

get_local_file_data(path)

Returns information about tar file.

get_remote_report_checksum(org_id)

Returns checksum of red_hat_inventory report present on satellite.

robottelo.rh_cloud_utils.get_host_counts(tarobj)

Returns hosts count from tar file. Args:

tarobj: tar file to get host count from

robottelo.rh_cloud_utils.get_local_file_data(path)

Returns information about tar file. Args:

path: path to tar file

robottelo.rh_cloud_utils.get_remote_report_checksum(org_id)

Returns checksum of red_hat_inventory report present on satellite. Args:

org_id: organization-id

robottelo.rhsso_utils

Utility module to handle the rhsso-satellite configure UI/CLI/API testing

Module Contents
Functions

run_command(cmd, hostname=satellite, timeout=None)

helper function for ssh command and avoiding the return code check in called function

get_rhsso_client_id()

Getter method for fetching the client id and can be used other functions

get_rhsso_user_details(username)

Getter method to receive the user id

get_rhsso_groups_details(group_name)

Getter method to receive the group id

upload_rhsso_entity(json_content, entity_name)

Helper method upload the entity json request as file on RHSSO Server

create_mapper(json_content, client_id)

Helper method to create the RH-SSO Client Mapper

create_new_rhsso_user(client_id, username=None)

create new user in RHSSO instance and set the password

update_rhsso_user(username, group_name=None)

delete_rhsso_user(username)

Delete the RHSSO user

create_group(group_name=None)

Create the RHSSO group

delete_rhsso_group(group_name)

Delete the RHSSO group

update_client_configuration(json_content)

Update the client configuration

get_oidc_token_endpoint()

getter oidc token endpoint

get_oidc_client_id()

getter for the oidc client_id

get_oidc_authorization_endpoint()

getter for the oidc authorization endpoint

get_two_factor_token_rh_sso_url()

getter for the two factor token rh_sso url

open_pxssh_session(ssh_key=settings.server.ssh_key, hostname=settings.server.hostname, username=settings.server.ssh_username)

set_the_redirect_uri()

Attributes

satellite

rhsso_host

realm

rhsso_user

rhsso_password

robottelo.rhsso_utils.satellite
robottelo.rhsso_utils.rhsso_host
robottelo.rhsso_utils.realm
robottelo.rhsso_utils.rhsso_user
robottelo.rhsso_utils.rhsso_password
robottelo.rhsso_utils.run_command(cmd, hostname=satellite, timeout=None)

helper function for ssh command and avoiding the return code check in called function

robottelo.rhsso_utils.get_rhsso_client_id()

Getter method for fetching the client id and can be used other functions

robottelo.rhsso_utils.get_rhsso_user_details(username)

Getter method to receive the user id

robottelo.rhsso_utils.get_rhsso_groups_details(group_name)

Getter method to receive the group id

robottelo.rhsso_utils.upload_rhsso_entity(json_content, entity_name)

Helper method upload the entity json request as file on RHSSO Server

robottelo.rhsso_utils.create_mapper(json_content, client_id)

Helper method to create the RH-SSO Client Mapper

robottelo.rhsso_utils.create_new_rhsso_user(client_id, username=None)

create new user in RHSSO instance and set the password

robottelo.rhsso_utils.update_rhsso_user(username, group_name=None)
robottelo.rhsso_utils.delete_rhsso_user(username)

Delete the RHSSO user

robottelo.rhsso_utils.create_group(group_name=None)

Create the RHSSO group

robottelo.rhsso_utils.delete_rhsso_group(group_name)

Delete the RHSSO group

robottelo.rhsso_utils.update_client_configuration(json_content)

Update the client configuration

robottelo.rhsso_utils.get_oidc_token_endpoint()

getter oidc token endpoint

robottelo.rhsso_utils.get_oidc_client_id()

getter for the oidc client_id

robottelo.rhsso_utils.get_oidc_authorization_endpoint()

getter for the oidc authorization endpoint

robottelo.rhsso_utils.get_two_factor_token_rh_sso_url()

getter for the two factor token rh_sso url

robottelo.rhsso_utils.open_pxssh_session(ssh_key=settings.server.ssh_key, hostname=settings.server.hostname, username=settings.server.ssh_username)
robottelo.rhsso_utils.set_the_redirect_uri()
robottelo.ssh

Utility module to handle the shared ssh connection.

Module Contents
Classes

SSHCommandResult

Structure that returns in all ssh commands results.

SSHClient

Extended SSHClient allowing custom methods

Functions

decode_to_utf8(text)

Paramiko returns bytes object and we need to ensure it is utf-8 before

_call_paramiko_sshclient()

Call paramiko.SSHClient.

get_client(hostname=None, username=None, password=None, key_filename=None, key_string=None, timeout=None, port=22)

Returns a SSH client connected to given hostname

get_connection(hostname=None, username=None, password=None, key_filename=None, key_string=None, timeout=None, port=22)

Yield an ssh connection object.

get_sftp_session(hostname=None, username=None, password=None, key_filename=None, key_string=None, timeout=None)

Yield a SFTP session object.

add_authorized_key(key, hostname=None, username=None, password=None, key_filename=None, key_string=None, timeout=None)

Appends a local public ssh key to remote authorized keys

upload_file(local_file, remote_file, key_filename=None, key_string=None, hostname=None)

Upload a local file to a remote machine

upload_files(local_dir, remote_dir, file_search='*.txt', hostname=None, key_filename=None, key_string=None)

Upload all files from directory to a remote directory

_upload_file(sftp, local_file, remote_file)

Upload a file using existent sftp session

download_file(remote_file, local_file=None, hostname=None)

Download a remote file to the local machine. If hostname is not

command(cmd, hostname=None, output_format=None, username=None, password=None, key_filename=None, key_string=None, timeout=None, connection_timeout=None, port=22)

Executes SSH command(s) on remote hostname.

execute_command(cmd, connection, output_format=None, timeout=None, connection_timeout=None)

Execute a command via ssh in the given connection

is_ssh_pub_key(key)

Validates if a string is in valid ssh pub key format

Attributes

logger

robottelo.ssh.logger
exception robottelo.ssh.SSHCommandTimeoutError

Bases: Exception

Raised when the SSH command has not finished executing after a predefined period of time.

robottelo.ssh.decode_to_utf8(text)

Paramiko returns bytes object and we need to ensure it is utf-8 before parsing

class robottelo.ssh.SSHCommandResult(stdout=None, stderr=None, return_code=0, output_format=None)

Structure that returns in all ssh commands results.

__repr__(self)

Return repr(self).

class robottelo.ssh.SSHClient

Bases: paramiko.SSHClient

Extended SSHClient allowing custom methods

run(self, cmd, *args, **kwargs)

This method exists to allow the reuse of existing connections when running multiple ssh commands as in the following example of use:

with robottelo.ssh.get_connection() as connection:

connection.run(‘ls /tmp’) connection.run(‘another command’)

self is always passed as the connection when used in context manager only when using ssh.get_connection function.

Note: This method is named run to avoid conflicts with existing exec_command and local function execute_command.

robottelo.ssh._call_paramiko_sshclient()

Call paramiko.SSHClient.

This function does not alter the behaviour of paramiko.SSHClient. It exists solely for the sake of easing unit testing: it can be overridden for mocking purposes.

robottelo.ssh.get_client(hostname=None, username=None, password=None, key_filename=None, key_string=None, timeout=None, port=22)

Returns a SSH client connected to given hostname

Processes ssh credentials in the order: password, key_filename, ssh_key Config validation enforces one of the three must be set in settings.server

robottelo.ssh.get_connection(hostname=None, username=None, password=None, key_filename=None, key_string=None, timeout=None, port=22)

Yield an ssh connection object.

The connection will be configured with the specified arguments or will fall-back to server configuration in the configuration file.

Yield this SSH connection. The connection is automatically closed when the caller is done using it using contextlib, so clients should use the with statement to handle the object:

with get_connection() as connection:
    ...

kwargs are passed through to get_client

Returns

An SSH connection.

Return type

paramiko.SSHClient

robottelo.ssh.get_sftp_session(hostname=None, username=None, password=None, key_filename=None, key_string=None, timeout=None)

Yield a SFTP session object.

The session will be configured with the host whose hostname is passed as argument.

Yield this SFTP Session. The session is automatically closed when the caller is done using it using contextlib, so clients should use the``with`` statement to handle the object:

with get_sftp_session() as session:
...

kwargs are passed through to get_connection

robottelo.ssh.add_authorized_key(key, hostname=None, username=None, password=None, key_filename=None, key_string=None, timeout=None)

Appends a local public ssh key to remote authorized keys

refer to: remote_execution_ssh_keys provisioning template

kwargs are passed through to get_client

Parameters

key – either a file path, key string or a file-like obj to append.

robottelo.ssh.upload_file(local_file, remote_file, key_filename=None, key_string=None, hostname=None)

Upload a local file to a remote machine

Parameters
  • local_file – either a file path or a file-like object to be uploaded.

  • remote_file – a remote file path where the uploaded file will be placed.

  • hostname – target machine hostname. If not provided will be used the server.hostname from the configuration.

  • key_filename (str) – The path of the ssh private key to use when connecting to the server. If it is None key_filename from configuration’s server section will be used.

robottelo.ssh.upload_files(local_dir, remote_dir, file_search='*.txt', hostname=None, key_filename=None, key_string=None)

Upload all files from directory to a remote directory

Parameters
  • local_dir – all files from local path to be uploaded.

  • remote_dir – a remote path where the uploaded files will be placed.

  • file_search – filter only files contains the type extension

  • hostname – target machine hostname. If not provided will be used the server.hostname from the configuration.

  • key_filename (str) – The path of the ssh private key to use when connecting to the server. If it is None key_filename from configuration’s server section will be used.

robottelo.ssh._upload_file(sftp, local_file, remote_file)

Upload a file using existent sftp session

Parameters
  • sftp – sftp session object

  • local_file – either a file path or a file-like object to be uploaded.

  • remote_file – a remote file path where the uploaded file will be placed.

robottelo.ssh.download_file(remote_file, local_file=None, hostname=None)

Download a remote file to the local machine. If hostname is not provided will be used the server.

robottelo.ssh.command(cmd, hostname=None, output_format=None, username=None, password=None, key_filename=None, key_string=None, timeout=None, connection_timeout=None, port=22)

Executes SSH command(s) on remote hostname.

kwargs are passed through to get_connection

Parameters
  • cmd (str) – The command to run

  • output_format (str) – json, csv or None

  • timeout (int) – Time to wait for the ssh command to finish.

  • connection_timeout – Time to wait for establishing the connection.

robottelo.ssh.execute_command(cmd, connection, output_format=None, timeout=None, connection_timeout=None)

Execute a command via ssh in the given connection

Parameters
  • cmd – a command to be executed via ssh

  • connection – SSH Paramiko client connection

  • output_format – base|json|csv|list valid only for hammer commands

  • timeout – Time to wait for the ssh command to finish.

  • connection_timeout – Time to wait for establishing the connection.

Returns

SSHCommandResult

robottelo.ssh.is_ssh_pub_key(key)

Validates if a string is in valid ssh pub key format

Parameters

key – A string containing a ssh public key encoded in base64

Returns

Boolean

robottelo.system_facts

JSON representation for a RHEL server.

Module Contents
Functions

_bios_date()

Generate a random date for system’s BIOS between

generate_system_facts(name=None)

Generate random system facts for registration.

Attributes

ARCHITECTURES

DISTRO_IDS

MEMORY_CAPACITY

MEMORY_SIZE

SYSTEM_FACTS

robottelo.system_facts._bios_date()

Generate a random date for system’s BIOS between today and 10 years ago.

Returns

A random datetime.date that falls within the last 10 years from today.

Return type

object

robottelo.system_facts.ARCHITECTURES = ['i386', 'x86_64', 'ppc', 's390x']
robottelo.system_facts.DISTRO_IDS
robottelo.system_facts.MEMORY_CAPACITY = ['2 GB', '4 GB', '8 GB', '16 GB']
robottelo.system_facts.MEMORY_SIZE = ['1024 MB', '2048 MB', '4096 MB', '8192 MB']
robottelo.system_facts.SYSTEM_FACTS
robottelo.system_facts.generate_system_facts(name=None)

Generate random system facts for registration.

Parameters

name (str) – A valid FQDN for a system. If one is not provided, then a random value will be generated.

Returns

A dictionary with random system facts

Return type

dict

robottelo.upgrade_utility

Common Upgrade test utilities

Module Contents
Functions

run_goferd(client_hostname=None)

Start the goferd process.

check_package_installed(client_hostname=None, package=None)

Verify if package is installed on docker content host.

install_or_update_package(client_hostname=None, update=False, package=None)

Install/update the package on docker content host.

create_repo(rpm_name, repo_path, post_upgrade=False, other_rpm=None)

Creates a custom yum repository, that will be synced to satellite

host_status(client_container_name=None)

fetch the content host details.

host_location_update(client_container_name=None, logger_obj=None, loc=None)

Check the content host status (as package profile update task does

publish_content_view(org=None, repolist=None)

publish content view and return content view

robottelo.upgrade_utility.run_goferd(client_hostname=None)

Start the goferd process. :param: str client_hostname: It should be container’s id.

robottelo.upgrade_utility.check_package_installed(client_hostname=None, package=None)

Verify if package is installed on docker content host. :param: str client_hostname: It should be container’s id. :param: str package: pass the package name to check the status :return: name of the installed package

robottelo.upgrade_utility.install_or_update_package(client_hostname=None, update=False, package=None)

Install/update the package on docker content host. :param: str client_hostname: It should be container’s id. :param: bool update: :param: str package:

robottelo.upgrade_utility.create_repo(rpm_name, repo_path, post_upgrade=False, other_rpm=None)

Creates a custom yum repository, that will be synced to satellite and later to capsule from satellite :param: str rpm_name : rpm name, required to create a repository. :param: str repo_path: Name of the repository path :param: bool post_upgrade: For Pre-upgrade, post_upgrade value will be False :param: str other_rpm: If we want to clean a specific rpm and update with latest then we pass other rpm.

robottelo.upgrade_utility.host_status(client_container_name=None)

fetch the content host details. :param: str client_container_name: The content host hostname :return: nailgun.entity.host: host

robottelo.upgrade_utility.host_location_update(client_container_name=None, logger_obj=None, loc=None)

Check the content host status (as package profile update task does take time to upload) and update location.

Param

str client_container_name: The content host hostname

Param

str loc: Location

robottelo.upgrade_utility.publish_content_view(org=None, repolist=None)

publish content view and return content view :param: str org: Name of the organisation :param: str repolist: Name of the repolist :return: Return content view

robottelo.virtwho_utils

Utility module to handle the virtwho configure UI/CLI/API testing

Module Contents
Functions

_parse_entry(entry)

Parse the string and return json format

get_system(system_type)

Return a dict account for ssh connect.

get_guest_info(hypervisor_type)

Return the guest_name, guest_uuid

runcmd(cmd, system=None, timeout=600, output_format='base')

Return the retcode and stdout.

register_system(system, activation_key=None, org='Default_Organization', env='Library')

Return True if the system is registered to satellite successfully.

virtwho_cleanup()

Before running test cases, need to clean the environment.

get_virtwho_status()

Return the status of virt-who service, it will help us to know

get_configure_id(name)

Return the configure id by hammer.

get_configure_command(config_id, org=DEFAULT_ORG)

Return the deploy command line based on configure id.

get_configure_file(config_id)

Return the configuration file full name in /etc/virt-who.d

get_configure_option(option, filename)

Return the option’s value for the specific file.

_get_hypervisor_mapping(logs, hypervisor_type)

Analysing rhsm.log and get to know: what is the hypervisor_name

deploy_validation(hypervisor_type)

Checkout the deploy result

deploy_configure_by_command(command, hypervisor_type, debug=False, org='Default_Organization')

Deploy and run virt-who servcie by the hammer command.

deploy_configure_by_script(script_content, hypervisor_type, debug=False)

Deploy and run virt-who service by the shell script.

restart_virtwho_service()

Do the following:

update_configure_option(option, value, config_file)

Update option in virt-who config file

delete_configure_option(option, config_file)

Delete option in virt-who config file

add_configure_option(option, value, config_file)

Add option to virt-who config file

hypervisor_json_create(hypervisors, guests)

Create a hypervisor guest json data. For example:

create_fake_hypervisor_content(org_label, hypervisors, guests)

Post the fake hypervisor content to satellite server

get_hypervisor_info(hypervisor_type)

Get the hypervisor_name and guest_name from rhsm.log.

virtwho_package_locked()

Uninstall virt-who package and lock the foreman-maintain packages.

create_http_proxy(name=None, url=None, type='https')

Creat a new http-proxy with attributes.

Attributes

VIRTWHO_SYSCONFIG

virtwho

robottelo.virtwho_utils.VIRTWHO_SYSCONFIG = /etc/sysconfig/virt-who
robottelo.virtwho_utils.virtwho
exception robottelo.virtwho_utils.VirtWhoError

Bases: Exception

Exception raised for failed virtwho operations

robottelo.virtwho_utils._parse_entry(entry)

Parse the string and return json format

robottelo.virtwho_utils.get_system(system_type)

Return a dict account for ssh connect.

Parameters

system_type (str) – The type of the system, should be one of (‘satellite’, ‘esx’, ‘xen’, ‘hyperv’, ‘rhevm’, ‘libvirt’, ‘kubevirt’).

Raises

VirtWhoError: If wrong system_type specified.

robottelo.virtwho_utils.get_guest_info(hypervisor_type)

Return the guest_name, guest_uuid

robottelo.virtwho_utils.runcmd(cmd, system=None, timeout=600, output_format='base')

Return the retcode and stdout.

Parameters
  • cmd (str) – The command line will be executed in the target system.

  • system (dict) – the system account which ssh will connect to, it will connect to the satellite host if the system is None.

  • timeout (int) – Time to wait for establish the connection.

  • output_format (str) – base|json|csv|list

robottelo.virtwho_utils.register_system(system, activation_key=None, org='Default_Organization', env='Library')

Return True if the system is registered to satellite successfully.

Parameters
  • system (dict) – system account used by ssh to connect and register.

  • activation_key (str) – the activation key will be used to register.

  • org (str) – Which organization will be used to register.

  • env (str) – Which environment will be used to register.

Raises

VirtWhoError: If failed to register the system.

robottelo.virtwho_utils.virtwho_cleanup()

Before running test cases, need to clean the environment. Do the following: 1. stop virt-who service. 2. kill all the virt-who pid 3. clean rhsm.log message, make sure there is no old message exist. 4. clean all the configure files in /etc/virt-who.d/

robottelo.virtwho_utils.get_virtwho_status()

Return the status of virt-who service, it will help us to know the virt-who configuration file is deployed or not.

robottelo.virtwho_utils.get_configure_id(name)

Return the configure id by hammer. :param str name: the configure name you have created. :raises: VirtWhoError: If failed to get the configure info by hammer.

robottelo.virtwho_utils.get_configure_command(config_id, org=DEFAULT_ORG)

Return the deploy command line based on configure id. :param str config_id: the unique id of the configure file you have created. :param str org: the satellite organization name.

robottelo.virtwho_utils.get_configure_file(config_id)

Return the configuration file full name in /etc/virt-who.d :param str config_id: the unique id of the configuration file you have created.

robottelo.virtwho_utils.get_configure_option(option, filename)

Return the option’s value for the specific file.

Parameters
  • option (str) – the option name in the configuration file

  • filename (str) – the configuration file, it could be: /etc/sysconfig/virt-who /etc/virt-who.d/virt-who-config-{}.conf

Raises

VirtWhoError: If this option name not in the file.

robottelo.virtwho_utils._get_hypervisor_mapping(logs, hypervisor_type)

Analysing rhsm.log and get to know: what is the hypervisor_name for the specific guest. :param str logs: the output of rhsm.log. :param str hypervisor_type: esx, libvirt, rhevm, xen, libvirt, kubevirt :raises: VirtWhoError: If hypervisor_name is None. :return: hypervisor_name and guest_name

robottelo.virtwho_utils.deploy_validation(hypervisor_type)

Checkout the deploy result :param str hypervisor_type: esx, libvirt, rhevm, xen, libvirt, kubevirt :raises: VirtWhoError: If failed to start virt-who servcie. :ruturn: hypervisor_name and guest_name

robottelo.virtwho_utils.deploy_configure_by_command(command, hypervisor_type, debug=False, org='Default_Organization')

Deploy and run virt-who servcie by the hammer command.

Parameters
  • command (str) – get the command by UI/CLI/API, it should be like: hammer virt-who-config deploy –id 1 –organization-id 1

  • hypervisor_type (str) – esx, libvirt, rhevm, xen, libvirt, kubevirt

  • debug (bool) – if VIRTWHO_DEBUG=1, this option should be True.

  • org (str) – Organization Label

robottelo.virtwho_utils.deploy_configure_by_script(script_content, hypervisor_type, debug=False)

Deploy and run virt-who service by the shell script. :param str script_content: get the script by UI or API. :param str hypervisor_type: esx, libvirt, rhevm, xen, libvirt, kubevirt :param bool debug: if VIRTWHO_DEBUG=1, this option should be True.

robottelo.virtwho_utils.restart_virtwho_service()

Do the following: 1. remove rhsm.log to ensure there are no old messages. 2. restart virt-who service via systemctl command

robottelo.virtwho_utils.update_configure_option(option, value, config_file)

Update option in virt-who config file :param option: the option you want to update :param value: set the option to the value :param config_file: path of virt-who config file

robottelo.virtwho_utils.delete_configure_option(option, config_file)

Delete option in virt-who config file :param option: the option you want to delete :param config_file: path of virt-who config file

robottelo.virtwho_utils.add_configure_option(option, value, config_file)

Add option to virt-who config file :param option: the option you want to add :param value: the value of the option :param config_file: path of virt-who config file

robottelo.virtwho_utils.hypervisor_json_create(hypervisors, guests)

Create a hypervisor guest json data. For example: {‘hypervisors’: [{‘hypervisorId’: ‘820b5143-3885-4dba-9358-4ce8c30d934e’, ‘guests’: [{‘guestId’: ‘afb91b1f-8438-46f5-bc67-d7ab328ef782’, ‘state’: 1, ‘attributes’: {‘active’: 1, ‘virtWhoType’: ‘esx’}}]}]} :param hypervisors: how many hypervisors will be created :param guests: how many guests will be created

robottelo.virtwho_utils.create_fake_hypervisor_content(org_label, hypervisors, guests)

Post the fake hypervisor content to satellite server :param hypervisors: how many hypervisors will be created :param guests: how many guests will be created :param org_label: the label of the Organization :return data: the hypervisor content

robottelo.virtwho_utils.get_hypervisor_info(hypervisor_type)

Get the hypervisor_name and guest_name from rhsm.log.

robottelo.virtwho_utils.virtwho_package_locked()

Uninstall virt-who package and lock the foreman-maintain packages.

robottelo.virtwho_utils.create_http_proxy(name=None, url=None, type='https')

Creat a new http-proxy with attributes. :param name: Name of the proxy :param url: URL of the proxy including schema (https://proxy.example.com:8080) :param type: https or http :return:

robottelo.vm

Utilities to create clients

Clients are virtual machines provisioned on a provisioning_server. All virtual machine images are stored on the image_dir path on the provisioning server.

Make sure to configure the clients section on the configuration file. Also make sure that the server have in place: the base images for rhel66 and rhel71, snap-guest and its dependencies and the image_dir path created.

Module Contents
Classes

VirtualMachine

Manages a virtual machine to allow client provisioning for robottelo

Attributes

logger

robottelo.vm.logger
exception robottelo.vm.VirtualMachineError

Bases: Exception

Exception raised for failed virtual machine management operations

class robottelo.vm.VirtualMachine(cpu=1, ram=512, distro=None, provisioning_server=None, image_dir=None, tag=None, hostname=None, domain=None, source_image=None, target_image=None, bridge=None, network=None)

Manages a virtual machine to allow client provisioning for robottelo

It expects that base images are created and snap-guest is setup on the provisioning server.

This also can be used as a context manager:

with VirtualMachine() as vm:
    result = vm.run('ls')
    out = result.stdout

Make sure to call destroy() to stop and clean the image on the provisioning server, otherwise the virtual machine and its image will stay on the server consuming hardware resources.

It is possible to customize the provisioning_server and image_dir as per virtual machine basis. Just set the wanted values when instantiating.

allowed_distros(self)

This is needed in construction, record it for easy reference Property instead of a class attribute to delay reading of the settings

property subscribed(self)
property domain(self)
property hostname(self)
property target_image(self)
create(self)

Creates a virtual machine on the provisioning server using snap-guest

Raises

robottelo.vm.VirtualMachineError – Whenever a virtual machine could not be executed.

destroy(self)

Destroys the virtual machine on the provisioning server

download_install_rpm(self, repo_url, package_name)

Downloads and installs custom rpm on the virtual machine.

Parameters
  • repo_url – URL to repository, where package is located.

  • package_name – Desired package name.

Returns

None.

Raises

robottelo.vm.VirtualMachineError – If package wasn’t installed.

enable_repo(self, repo, force=False)

Enables specified Red Hat repository on the virtual machine. Does nothing if capsule or satellite tools repo was passed and downstream with custom repo URLs detected (custom repos are enabled by default when registering a host).

Parameters
  • repo – Red Hat repository name.

  • force – enforce enabling command, even when custom repos are detected for satellite tools or capsule.

Returns

None.

subscription_manager_list_repos(self)
subscription_manager_status(self)
create_custom_repos(self, **kwargs)

Create custom repofiles. Each kwargs item will result in one repository file created. Where the key is the repository filename and repository name, and the value is the repository URL.

For example:

create_custom_repo(custom_repo='http://repourl.domain.com/path')

Will create a repository file named custom_repo.repo with the following contents:

[custom_repo]
name=custom_repo
baseurl=http://repourl.domain.com/path
enabled=1
gpgcheck=0
install_katello_agent(self)

Installs katello agent on the virtual machine.

Returns

None.

Raises

robottelo.vm.VirtualMachineError – If katello-ca wasn’t installed.

install_katello_host_tools(self)

Installs Katello host tools on the virtual machine

Raises

robottelo.vm.VirtualMachineError – If katello-host-tools wasn’t installed.

install_katello_ca(self)

Downloads and installs katello-ca rpm on the virtual machine.

Uses common helper install_katello_ca(hostname=None), but passes self.ip_addr instead of the hostname as we are using fake hostnames for virtual machines.

Returns

None.

Raises

robottelo.vm.VirtualMachineError – If katello-ca wasn’t installed.

install_capsule_katello_ca(self, capsule=None)

Downloads and installs katello-ca rpm on the virtual machine.

Param

str capsule: Capsule hostname

Raises

robottelo.vm.VirtualMachineError – If katello-ca wasn’t installed.

register_contenthost(self, org, activation_key=None, lce=None, consumerid=None, force=True, releasever=None, username=None, password=None, auto_attach=False)

Registers content host on foreman server using activation-key. This can be done in two ways: either by specifying organization name and activation key name or by specifying organization name and lifecycle environment name (administrator credentials for authentication will be passed automatically)

Parameters
  • activation_key – Activation key name to register content host with.

  • lce – lifecycle environment name to which register the content host.

  • consumerid – uuid of content host, register to this content host, content host has to be created before

  • org – Organization name to register content host for.

  • force – Register the content host even if it’s already registered

  • releasever – Set a release version

  • username – a user name to register the content host with

  • password – the user password

  • auto_attach – automatically attach compatible subscriptions to this system.

Returns

SSHCommandResult instance filled with the result of the registration.

remove_katello_ca(self)

Removes katello-ca rpm from the virtual machine.

Uses common helper remove_katello_ca(hostname=None), but passes self.ip_addr instead of the hostname as we are using fake hostnames for virtual machines.

Returns

None.

Raises

robottelo.vm.VirtualMachineError – If katello-ca wasn’t removed.

remove_capsule_katello_ca(self, capsule=None)

Removes katello-ca rpm and reset rhsm.conf from the virtual machine.

Param

str capsule: Capsule hostname

Raises

robottelo.vm.VirtualMachineError – If katello-ca wasn’t removed.

unregister(self)

Run subscription-manager unregister.

Returns

SSHCommandResult instance filled with the result of the unregistration.

run(self, cmd, timeout=None)

Runs a ssh command on the virtual machine

Parameters
  • cmd (str) – Command to run on the virtual machine

  • timeout (int) – Time to wait for the ssh command to finish

Returns

A robottelo.ssh.SSHCommandResult instance with the commands results

Return type

robottelo.ssh.SSHCommandResult

Raises

robottelo.vm.VirtualMachineError – If the virtual machine is not created.

get(self, remote_path, local_path=None)

Get a remote file from the virtual machine.

put(self, local_path, remote_path=None)

Put a local file to the virtual machine.

configure_rhel_repo(self, rhel_repo)

Configures specified Red Hat repository on the virtual machine.

Parameters

rhel_repo – Red Hat repository link from properties file.

Returns

None.

configure_puppet(self, rhel_repo=None, proxy_hostname=None)

Configures puppet on the virtual machine/Host. :param proxy_hostname: external capsule hostname :param rhel_repo: Red Hat repository link from properties file. :return: None.

execute_foreman_scap_client(self, policy_id=None)

Executes foreman_scap_client on the vm/clients to create security audit report.

Parameters

policy_id – The Id of the OSCAP policy.

Returns

None.

configure_rhai_client(self, activation_key, org, rhel_distro, register=True)

Configures a Red Hat Access Insights service on the system by installing the redhat-access-insights package and registering to the service.

Parameters
  • activation_key – Activation key to be used to register the system to satellite

  • org – The org to which the system is required to be registered

  • rhel_distro – rhel distribution for

  • register – Whether to register client to insights

Returns

None

set_infrastructure_type(self, infrastructure_type='physical')

Force host to appear as bare-metal or virtual machine in subscription-manager fact.

Parameters

infrastructure_type (str) – One of “physical”, “virtual”

patch_os_release_version(self, distro=DISTRO_RHEL7)

Patch VM OS release version.

This is needed by yum package manager to generate the right RH repositories urls.

__enter__(self)
__exit__(self, *exc)
robottelo.vm_capsule

Virtual machine client provisioning with satellite capsule product setup

Module Contents
Classes

CapsuleVirtualMachine

Virtual machine client provisioning with satellite capsule product

Attributes

logger

robottelo.vm_capsule.logger
exception robottelo.vm_capsule.CapsuleVirtualMachineError

Bases: Exception

Exception raised for failed capsule virtual machine operations

class robottelo.vm_capsule.CapsuleVirtualMachine(cpu=4, ram=16384, distro=None, provisioning_server=None, image_dir=None, org_id=None, lce_id=None, organization_ids=None, location_ids=None)

Bases: robottelo.vm.VirtualMachine

Virtual machine client provisioning with satellite capsule product setup

property hostname_local(self)

The virtual machine local hostname from provisioning server

property capsule_org(self)
property capsule(self)
property capsule_lce(self)
property capsule_location_ids(self)
property capsule_organization_ids(self)
_capsule_setup_name_resolution(self)

Setup a name resolution so the capsule and satellite are resolvable

_capsule_cleanup(self)

make the necessary cleanup in case of a crash

_setup_capsule(self)

Prepare the virtual machine to host a capsule node

create(self)

Creates a virtual machine on the provisioning server using snap-guest

Raises

robottelo.vm.VirtualMachineError – Whenever a virtual machine could not be executed.

suspend(self, ensure=False, timeout=None, connection_timeout=30)

Suspend the virtual machine.

Parameters
  • ensure (bool) – ensure that the virtual machine is unreachable

  • timeout (int) – Time to wait for the ssh command to finish.

  • connection_timeout (int) – Time to wait for establishing the connection.

Notes:

  1. The virtual machine will consume system RAM but not processor resources. Disk and network I/O does not occur while the guest is suspended.

  2. This operation is immediate and the guest can be restarted with resume.

resume(self, ensure=False, timeout=None, connection_timeout=30)

Restore from a suspended state

Parameters
  • ensure (bool) – ensure that the virtual machine is reachable

  • timeout (int) – Time to wait for the ssh command to finish.

  • connection_timeout (int) – Time to wait for establishing the connection.

Note: This operation is immediate

destroy(self)

Destroys the virtual machine on the provisioning server

1

Created with sphinx-autoapi

hidden

committing code_standards reviewing_PRs features/index autoapi/index

Want to contribute? Before submitting code, read through the committing guide and Robottelo code standards. Ready to start reviewing pull requests? We have a guide for that too! Finally, the API reference covers individual functions, classes, methods and modules.

Robottelo is compatible with Python 3.6+.

Bugs are listed on GitHub. If you think you’ve found a new issue, please do one of the following:

  • Open a new bug report on Github.

  • Join the #robottelo IRC channel on Freenode (irc.freenode.net).

You can generate the documentation for Robottelo as follows, so long as you have Sphinx and make installed:

$ cd docs
$ make html

You can generate a graph of Foreman entities and their dependencies, so long as you have graphviz installed:

$ make graph-entities

To check for code smells:

$ pre-commit install-hooks
$ pre-commit run --all-files

The design and development for this software is led by Og Maciel.