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 |
SubscriptionManager¶
Subscription Manager.
This class represents the subscription-manager tool.
is_registered
property
¶
Query whether subscription-manager is registered.
Returns:
| Type | Description |
|---|---|
bool
|
Whether |
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
|
()
|
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 |
()
|
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 |
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. |
get_services_api_base_url()
¶
Return the base URL used to build direct Inventory and Advisor requests.
Satellite profiles use their configured base URL, including its proxy path
prefix. Other profiles use the stage or production services host with the
/api prefix.
Returns:
| Type | Description |
|---|---|
str
|
The services API base URL. |
get_services_api_host()
¶
Return the hostname for direct Insights API calls.
Satellite profiles use the host and port from their configured API base
URL. Other profiles use the stage host when the client base URL contains
.stage., and the production host otherwise.
Returns:
| Type | Description |
|---|---|
str
|
The API host, including a configured port when present. |
get_services_api_verify()
¶
Return the TLS verify setting for Inventory and Advisor requests.
Preference order:
services_api_verifypassed to the constructor (typically from Dynaconfinsights.ca_path/insights.insecure)cert_verifyfrominsights-client.confwhen setTrue(system CA store)
Returns:
| Type | Description |
|---|---|
bool | str
|
Passed to |
register(selinux_context=None, wait_for_registered=False)
¶
Register with insights-client.
Invokes insights-client --register.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
selinux_context
|
str | None
|
SELinux context in which to run insights-client,
for more details see |
None
|
wait_for_registered
|
bool
|
Loop and wait until registration finishes if set to True |
False
|
Returns:
| Type | Description |
|---|---|
subprocess.CompletedProcess
|
The result of the command execution |
run(*args, check=True, text=True, selinux_context='system_u:system_r:insights_client_t:s0')
¶
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 |
()
|
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
|
selinux_context
|
str | None
|
SELinux context in which to run insights-client |
'system_u:system_r:insights_client_t:s0'
|
Returns:
| Type | Description |
|---|---|
subprocess.CompletedProcess
|
The result of the command execution |
unregister(selinux_context=None)
¶
Unregister with insights-client.
Invokes insights-client --unregister.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
selinux_context
|
str | None
|
SELinux context in which to run insights-client,
for more details see |
None
|
Returns:
| Type | Description |
|---|---|
subprocess.CompletedProcess
|
The result of the command execution |
wait_for_advisor(*args, **kwargs)
¶
Wait for the system to be present in the Advisor application.
Raises same exceptions as _check_in_advisor
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
Additional positional arguments passed for |
()
|
|
kwargs
|
Additional keyword arguments passed for |
{}
|
Returns:
| Type | Description |
|---|---|
bool
|
True if this system is present in advisor |
wait_for_inventory(*args, **kwargs)
¶
Wait for the system to have ID assigned in the inventory.
Raises same exceptions as _get_inventory_id
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
Additional positional arguments passed for |
()
|
|
kwargs
|
Additional keyword arguments passed for |
{}
|
Returns:
| Type | Description |
|---|---|
str
|
The inventory ID of the system |
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
KeyErroris raisen
Please note that changing attributes does not automatically update the
configuration file; save() must be called explicitly when needed.
Rhc¶
Rhc.
This class represents the rhc tool.
is_registered
property
¶
Query whether rhc is registered.
Returns:
| Type | Description |
|---|---|
bool
|
Whether |
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
|
()
|
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 |
()
|
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¶
Inventory¶
Inventory
This class represents an Inventory server.
base_url
property
¶
The base URL of the Inventory server.
delete(path, **kwargs)
¶
Perform a DELETE REST call.
get(path, **kwargs)
¶
Perform a GET REST call.
this_system(retries=3, delay=5)
¶
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.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
retries
|
Number of times to retry the request |
3
|
|
delay
|
Seconds to wait after GET request |
5
|
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¶
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: