Skip to content

APIs

Candlepin

Candlepin

This class represents a Candlepin server.

host property

The hostname of the Candlepin server.

insecure property

Whether verify the SSL connection to the Candlepin server.

port property

The port of the Candlepin server.

prefix property

The prefix of the Candlepin server.

get(path, **kwargs)

Perform a GET REST call.

post(path, data, **kwargs)

Perform a POST REST call.

status()

Get the status of the Candlepin server.

This is a shortcut for querying the /status endpoint, returning its output as JSON.

Returns:

Type Description
dict

The JSON dictionary of Candlepin's /status endpoint

version()

Get the version string of the Candlepin server as Version object.

Returns:

Type Description
pytest_client_tools.util.Version

The version of Candlepin

SubscriptionManager

Subscription Manager.

This class represents the subscription-manager tool.

is_registered property

Query whether subscription-manager is registered.

Returns:

Type Description
bool

Whether subscription-manager is registered

uuid property

Return the UUID of the registered system.

Raises SystemNotRegisteredError if the system is not registered.

Returns:

Type Description
uuid.UUID

The UUID of the system

register(username=None, password=None, org=None, activationkey=None, environments=None, *extra_args)

Register with subscription-manager.

Invokes subscription-manager register.

Parameters:

Name Type Description Default
username str, optional

The username to use for registering

None
password str, optional

The password to use for registering

None
org str, optional

The organization to use for registering

None
activationkey str | list, optional

The activation keys to use for registering; this can be either a list of keys, or a single string with keys separated by comma

None
environments str | list, optional

The environments to use for registering; this can be either a list of environments, or a single string with environments separated by comma

None
extra_args list, optional

Additional parameters to run, passed straight to subscription-manager register

()

Returns:

Type Description
subprocess.CompletedProcess

The result of the command execution

run(*args, check=True, text=True)

Run subscription-manager with the specified arguments.

This function is a simple wrapper around invoking subscription-manager with a specified list of arguments, returning the result of the execution directly from subprocess.

Parameters:

Name Type Description Default
args list

The actual arguments to run using subscription-manager

()
check bool

Whether raise an exception if the process exits with a return code different than 0

True
text bool

Whether the stdin/stdout of the process are textual (and not bytes)

True

Returns:

Type Description
subprocess.CompletedProcess

The result of the command execution

unregister()

Unregister with subscription-manager.

Invokes subscription-manager unregister.

Returns:

Type Description
subprocess.CompletedProcess

The result of the command execution

InsightsClient

Insights Client.

This class represents the insights-client tool.

It exposes a public config attribute (which is InsightsClientConfig) representing the configuration of insights-client, i.e. /etc/insights-client/insights-client.conf.

core_version property

Return the version of insights-core as Version object.

Returns:

Type Description
pytest_client_tools.util.Version

The version of the insights-core in use.

is_registered property

Query whether insights-client is registered.

Returns:

Type Description
bool

Whether insights-client is registered

uuid property

Return the UUID of the registered system.

Raises SystemNotRegisteredError if the system is not registered.

Returns:

Type Description
uuid.UUID

The UUID of the system

version property

Return the version of insights-client as Version object.

Returns:

Type Description
pytest_client_tools.util.Version

The version of the insights-client in use.

register()

Register with insights-client.

Invokes insights-client --register.

Returns:

Type Description
subprocess.CompletedProcess

The result of the command execution

run(*args, check=True, text=True)

Run insights-client with the specified arguments.

This function is a simple wrapper around invoking insights-client with a specified list of arguments, returning the result of the execution directly from subprocess.

Parameters:

Name Type Description Default
args list

The actual arguments to run using insights-client

()
check bool

Whether raise an exception if the process exits with a return code different than 0

True
text bool

Whether the stdin/stdout of the process are textual (and not bytes)

True

Returns:

Type Description
subprocess.CompletedProcess

The result of the command execution

unregister()

Unregister with insights-client.

Invokes insights-client --unregister.

Returns:

Type Description
subprocess.CompletedProcess

The result of the command execution

InsightsClientConfig

Insights Client configuration.

This class represents the configuration of insights-client, i.e. /etc/insights-client/insights-client.conf by default.

This class uses attributes to represents the various configuration bits:

  • setting an attribute for a known configuration key sets the corresponding configuration value
  • setting an attribute for an unknown configuration key only sets a new instance variable, without changing the actual configuration
  • getting an attribute for a known configuration key sets returns the configuration value if set, otherwise KeyError is raisen

Please note that changing attributes does not automatically update the configuration file; save() must be called explicitly when needed.

reload()

Reload the configuration.

Reload the configuration from the underlying file, discarding all the values set in the instance.

save()

Save the configuration.

Save the configuration values to the underlying configuration file.

Rhc

Rhc.

This class represents the rhc tool.

is_registered property

Query whether rhc is registered.

Returns:

Type Description
bool

Whether rhc is registered

version property

Return the version of rhc as Version object.

Returns:

Type Description
pytest_client_tools.util.Version

The version of the rhc in use.

connect(username=None, password=None, org=None, activationkey=None, *extra_args)

Connect with rhc.

Invokes rhc connect.

Parameters:

Name Type Description Default
username str, optional

The username to use for registering

None
password str, optional

The password to use for registering

None
org str, optional

The organization to use for registering

None
activationkey str, optional

The activation keys to use for registering; this is single string with keys separated by comma

None
extra_args list, optional

Additional parameters to run, passed straight to rhc connect

()

Returns:

Type Description
subprocess.CompletedProcess

The result of the command execution

disconnect()

Disconnect with rhc.

Invokes rhc disconnect.

Returns:

Type Description
subprocess.CompletedProcess

The result of the command execution

run(*args, check=True, text=True)

Run rhc with the specified arguments.

This function is a simple wrapper around invoking rhc with a specified list of arguments, returning the result of the execution directly from rhc.

Parameters:

Name Type Description Default
args list

The actual arguments to run using rhc

()
check bool

Whether raise an exception if the process exits with a return code different than 0

True
text bool

Whether the stdin/stdout of the process are textual (and not bytes)

True

Returns:

Type Description
subprocess.CompletedProcess

The result of the command execution

TestConfig

Configuration for the tests.

environment property

Returns the Dynaconf environment currently in use.

is_external property

Determines whether an external Candlepin is configured.

get(*path)

Query for a configuration key.

Parameters:

Name Type Description Default
path str

The path/name of the configuration key

()

Inventory

Inventory

This class represents an Inventory server.

base_url property

The base URL of the Inventory server.

get(path, **kwargs)

Perform a GET REST call.

this_system()

Query Inventory for the current system.

This assumes the current system is already registered with insights-client. Raises SystemNotRegisteredError if the system is not registered.

Returns:

Type Description
dict

The dict of the current system in Inventory

this_system_profile()

Query Inventory for the system profile of the current system.

This assumes the current system is already registered with insights-client.

Returns:

Type Description
dict

The dict of the system profile of the current system in Inventory

this_system_tags()

Query Inventory for the tags of the current system.

This assumes the current system is already registered with insights-client.

Returns:

Type Description
dict

The dict of the tags of the current system in Inventory

SystemNotRegisteredError

Bases: RuntimeError

The system is not registered.

Version

Version.

A simple representation of a version number/string in the format X, or X.Y, or X.Y.Z, or in general a sequence of dot-spearated numbers. Pre-release markers such as "alpha/beta/etc" are not supported.

__init__(*args)

Create a new Version object.

The passed arguments can either of:

  • a single string which is parsed
  • integer arguments representing the component of the version number

Examples:

>>> Version("1.2")
Version(1.2)
>>> Version(1, 3)
Version(1.3)
>>> Version(1, 3) == Version("1.2")
False
>>> Version(1, 3, 1) >= Version("1.3")
True