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