ironic_python_agent.agent module

class ironic_python_agent.agent.Host(hostname, port)

Bases: tuple

hostname

Alias for field number 0

port

Alias for field number 1

class ironic_python_agent.agent.IronicPythonAgent(api_url, advertise_address, listen_address, ip_lookup_attempts, ip_lookup_sleep, network_interface, lookup_timeout, lookup_interval, standalone, agent_token, hardware_initialization_delay=0, advertise_protocol='http')[source]

Bases: ExecuteCommandMixin

Class for base agent functionality.

force_heartbeat()[source]
classmethod from_config(conf)[source]
get_command_result(result_id)[source]

Get a specific command result by ID.

Returns:

a ironic_python_agent.extensions.base. BaseCommandResult object.

Raises:

RequestedObjectNotFoundError if command with the given ID is not found.

get_node_uuid()[source]

Get UUID for Ironic node.

If the agent has not yet heartbeated to Ironic, it will not have the UUID and this will raise an exception.

Returns:

A string containing the UUID for the Ironic node.

Raises:

UnknownNodeError if UUID is unknown.

get_status()[source]

Retrieve a serializable status.

Returns:

a ironic_python_agent.agent.IronicPythonAgent instance describing the agent’s status.

list_command_results()[source]

Get a list of command results.

Returns:

list of ironic_python_agent.extensions.base. BaseCommandResult objects.

process_lookup_data(content)[source]

Update agent configuration from lookup data.

run()[source]

Run the Ironic Python Agent.

serve_ipa_api()[source]

Serve the API until an extension terminates it.

set_agent_advertise_addr()[source]

Set advertised IP address for the agent, if not already set.

If agent’s advertised IP address is still default (None), try to find a better one. If the agent’s network interface is None, replace that as well.

Raises:

LookupAgentIPError if an IP address could not be found

validate_agent_token(token)[source]
class ironic_python_agent.agent.IronicPythonAgentHeartbeater(agent)[source]

Bases: Thread

Thread that periodically heartbeats to Ironic.

do_heartbeat()[source]

Send a heartbeat to Ironic.

force_heartbeat()[source]
max_error_jitter_multiplier = 2.0
max_jitter_multiplier = 0.6
min_error_jitter_multiplier = 1.0
min_heartbeat_interval = 5
min_jitter_multiplier = 0.3
run()[source]

Start the heartbeat thread.

stop()[source]

Stop the heartbeat thread.

class ironic_python_agent.agent.IronicPythonAgentStatus(started_at, version)[source]

Bases: Serializable

Represents the status of an agent.

serializable_fields = ('started_at', 'version')