Client for V1 API.
ironic_inspector_client.v1.
ClientV1
(**kwargs)[source]¶Bases: ironic_inspector_client.common.http.BaseClient
Client for API v1.
Create this object to use Python API, for example:
import ironic_inspector_client
client = ironic_inspector_client.ClientV1(session=keystone_session)
This code creates a client with API version 1.0 and a given Keystone
session.
The service URL is fetched from the service catalog in this case. Optional
arguments service_type
, interface
and region_name
can be
provided to modify how the URL is looked up.
If the catalog lookup fails, the local host with port 5050 is tried.
However, this behaviour is deprecated and should not be relied on.
Also an explicit inspector_url
can be passed to bypass service catalog.
Optional api_version
argument is a minimum API version that a server
must support. It can be a tuple (MAJ, MIN), string “MAJ.MIN” or integer
(only major, minimum supported minor version is assumed).
Variables: | rules – Reference to the introspection rules API.
Instance of ironic_inspector_client.v1.RulesAPI . |
---|
abort
(uuid)[source]¶Abort running introspection for a node.
Parameters: | uuid – node UUID or name. |
---|---|
Raises: | ironic_inspector_client.ClientError on error
reported from a server |
Raises: | ironic_inspector_client.VersionNotSupported if
requested api_version is not supported |
Raises: | requests library exception on connection problems. |
Raises: | TypeError if uuid is not a string. |
get_all_interface_data
(node_ident, field_sel, vlan=None)[source]¶Get interface data for all of the interfaces on this node
Parameters: |
|
---|---|
Returns: | list of interface data, each interface in a list |
get_data
(uuid, raw=False)[source]¶Get introspection data from the last introspection of a node.
If swift support is disabled, introspection data won’t be stored, this request will return error response with 404 code.
Parameters: |
|
---|---|
Returns: | bytes or a dict depending on the ‘raw’ argument |
Raises: |
|
Raises: |
|
Raises: | requests library exception on connection problems. |
Raises: | TypeError if uuid is not a string |
get_interface_data
(node_ident, interface, field_sel)[source]¶Get interface data for the input node and interface
To get LLDP data, collection must be enabled by the kernel parameter
ipa-collect-lldp=1
, and the inspector plugin basic_lldp
must
be enabled.
Parameters: |
|
---|---|
Returns: | interface data in OrderedDict |
Raises: | ValueError if interface is not found. |
get_status
(uuid)[source]¶Get introspection status for a node.
Parameters: | uuid – node UUID or name. |
---|---|
Raises: | ironic_inspector_client.ClientError on error
reported from a server |
Raises: | ironic_inspector_client.VersionNotSupported
if requested api_version is not supported |
Raises: | requests library exception on connection problems. |
Returns: | dictionary with the keys:
|
introspect
(uuid, manage_boot=None)[source]¶Start introspection for a node.
Parameters: |
|
---|---|
Raises: |
|
Raises: |
|
Raises: | requests library exception on connection problems. |
list_statuses
(marker=None, limit=None)[source]¶List introspection statuses.
Supports pagination via the marker and limit params. The items are sorted by the server according to the started_at attribute, newer items first.
Parameters: |
|
---|---|
Raises: |
|
Raises: |
|
Raises: | requests library exception on connection problems. |
Returns: | a list of status dictionaries with the keys:
|
reprocess
(uuid)[source]¶Reprocess stored introspection data.
If swift support is disabled, introspection data won’t be stored, this request will return error response with 404 code.
Parameters: | uuid – node UUID or name. |
---|---|
Raises: | ironic_inspector_client.ClientError on error
reported from a server |
Raises: | ironic_inspector_client.VersionNotSupported if
requested api_version is not supported |
Raises: | requests library exception on connection problems. |
Raises: | TypeError if uuid is not a string. |
wait_for_finish
(uuids, retry_interval=10, max_retries=3600, sleep_function=<built-in function sleep>)[source]¶Wait for introspection finishing for given nodes.
Parameters: |
|
---|---|
Raises: |
|
Raises: |
|
Raises: |
|
Raises: | requests library exception on connection problems. |
Returns: | dictionary UUID -> status (the same as in get_status). |
ironic_inspector_client.v1.
DEFAULT_API_VERSION
= (1, 0)¶Server API version used by default.
ironic_inspector_client.v1.
DEFAULT_MAX_RETRIES
= 3600¶Default number of retries when waiting for introspection to finish.
ironic_inspector_client.v1.
DEFAULT_RETRY_INTERVAL
= 10¶Default interval (in seconds) between retries when waiting for introspection to finish.
ironic_inspector_client.v1.
MAX_API_VERSION
= (1, 13)¶Maximum API version this client was designed to work with.
This does not mean that other versions won’t work at all - the server might still support them.
ironic_inspector_client.v1.
RulesAPI
(requester)[source]¶Bases: object
Introspection rules API.
Do not create instances of this class directly, use
ironic_inspector_client.v1.ClientV1.rules
instead.
create
(conditions, actions, uuid=None, description=None)[source]¶Create a new introspection rule.
Parameters: |
|
---|---|
Returns: | rule representation |
Raises: |
|
Raises: |
|
delete
(uuid)[source]¶Delete an introspection rule.
Parameters: | uuid – rule UUID |
---|---|
Raises: | ironic_inspector_client.ClientError on error
reported from a server |
Raises: | ironic_inspector_client.VersionNotSupported if
requested api_version is not supported |
delete_all
()[source]¶Delete all introspection rules.
Raises: | ironic_inspector_client.ClientError on error
reported from a server |
---|---|
Raises: | ironic_inspector_client.VersionNotSupported if
requested api_version is not supported |
from_json
(json_rule)[source]¶Import an introspection rule from JSON data.
Parameters: | json_rule – rule information as a dict with keys matching
arguments of RulesAPI.create() . |
---|---|
Returns: | rule representation |
Raises: | ironic_inspector_client.ClientError on error
reported from a server |
Raises: | ironic_inspector_client.VersionNotSupported if
requested api_version is not supported |
get
(uuid)[source]¶Get detailed information about an introspection rule.
Parameters: | uuid – rule UUID |
---|---|
Returns: | rule representation |
Raises: | ironic_inspector_client.ClientError on error
reported from a server |
Raises: | ironic_inspector_client.VersionNotSupported if
requested api_version is not supported |
get_all
()[source]¶List all introspection rules.
Returns: | list of short rule representations (uuid, description and links) |
---|---|
Raises: | ironic_inspector_client.ClientError on error
reported from a server |
Raises: | ironic_inspector_client.VersionNotSupported if
requested api_version is not supported |
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.