ironic_inspector_client package

Module contents

exception ironic_inspector_client.ClientError(response)[source]

Bases: requests.exceptions.HTTPError

Error returned from a server.

classmethod raise_if_needed(response)[source]

Raise exception if response contains error.

class ironic_inspector_client.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(node_id=None, uuid=None)[source]

Abort running introspection for a node.

Parameters
  • uuid – node UUID or name, deprecated

  • node_id – node node_id 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
  • node_ident – node UUID or name

  • field_sel – list of all fields for which to get data

  • vlan – list of vlans used to filter the lists returned

Returns

list of interface data, each interface in a list

get_data(node_id=None, raw=False, uuid=None, processed=True)[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
  • uuid – node UUID or name, deprecated

  • node_id – node node_id or name

  • raw – whether to return raw binary data or parsed JSON data

  • processed – whether to return the final processed data or the raw unprocessed data received from the ramdisk.

Returns

bytes or a dict depending on the ‘raw’ argument

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_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
  • node_ident – node UUID or name

  • interface – interface name

  • field_sel – list of all fields for which to get data

Returns

interface data in OrderedDict

Raises

ValueError if interface is not found.

get_status(node_id=None, uuid=None)[source]

Get introspection status for a node.

Parameters
  • uuid – node UUID or name, deprecated

  • node_id – node node_id 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:

  • error an error string or None,

  • finished whether introspection was finished,

  • finished_at an ISO8601 timestamp or None,

  • links with a self-link URL,

  • started_at an ISO8601 timestamp,

  • uuid the node UUID

introspect(node_id=None, manage_boot=None, uuid=None)[source]

Start introspection for a node.

Parameters
  • uuid – node UUID or name, deprecated

  • node_id – node node_id or name

  • manage_boot – whether to manage boot during introspection of this node. If it is None (the default), then this argument is not passed to API and the server default is used instead.

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.

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
  • marker – pagination maker, UUID or None

  • limit – pagination limit, int or None

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

a list of status dictionaries with the keys:

  • error an error string or None,

  • finished whether introspection was finished,

  • finished_at an ISO8601 timestamp or None,

  • links with a self-link URL,

  • started_at an ISO8601 timestamp,

  • uuid the node UUID

reprocess(node_id=None, uuid=None)[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, deprecated

  • node_id – node node_id 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(node_ids=None, retry_interval=10, max_retries=3600, sleep_function=<built-in function sleep>, uuids=None)[source]

Wait for introspection finishing for given nodes.

Parameters
  • uuids – collection of node UUIDs or names, deprecated

  • node_ids – collection of node node_ids or names

  • retry_interval – sleep interval between retries.

  • max_retries – maximum number of retries.

  • sleep_function – function used for sleeping between retries.

Raises

ironic_inspector_client.WaitTimeoutError on timeout

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 UUID -> status (the same as in get_status).

exception ironic_inspector_client.EndpointNotFound(service_type)[source]

Bases: Exception

Denotes that endpoint for the introspection service was not found.

Variables

service_type – requested service type

exception ironic_inspector_client.VersionNotSupported(expected, supported)[source]

Bases: Exception

Denotes that requested API versions is not supported by the server.

Variables
  • expected – requested version.

  • supported – sequence with two items: minimum and maximum actually supported versions.