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. |
register(selinux_context=None)
¶
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
|
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 |
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: