ironicclient.v1.create_resources module

ironicclient.v1.create_resources.create_chassis(client, chassis_list)[source]

Create chassis from dictionaries.

Parameters:
  • client – ironic client instance.

  • chassis_list – list of dictionaries to be POSTed to /chassis endpoint, if some of them contain “nodes” key, its content is POSTed separately to /nodes endpoint.

Returns:

array of exceptions encountered during creation.

ironicclient.v1.create_resources.create_nodes(client, node_list, chassis_uuid=None)[source]

Create nodes from dictionaries.

Parameters:
  • client – ironic client instance.

  • node_list – list of dictionaries to be POSTed to /nodes endpoint, if some of them contain “ports” key, its content is POSTed separately to /ports endpoint.

  • chassis_uuid – UUID of a chassis the nodes should be associated with.

Returns:

array of exceptions encountered during creation.

ironicclient.v1.create_resources.create_portgroups(client, portgroup_list, node_uuid)[source]

Create port groups from dictionaries.

Parameters:
  • client – ironic client instance.

  • portgroup_list – list of dictionaries to be POSTed to /portgroups endpoint, if some of them contain “ports” key, its content is POSTed separately to /ports endpoint.

  • node_uuid – UUID of a node the port groups should be associated with.

Returns:

array of exceptions encountered during creation.

ironicclient.v1.create_resources.create_ports(client, port_list, node_uuid, portgroup_uuid=None)[source]

Create ports from dictionaries.

Parameters:
  • client – ironic client instance.

  • port_list – list of dictionaries to be POSTed to /ports endpoint.

  • node_uuid – UUID of a node the ports should be associated with.

  • portgroup_uuid – UUID of a port group the ports should be associated with, if they are its members.

Returns:

array of exceptions encountered during creation.

ironicclient.v1.create_resources.create_resources(client, filenames)[source]

Create resources using their JSON or YAML descriptions.

Parameters:
  • client – an instance of ironic client;

  • filenames – a list of filenames containing JSON or YAML resources definitions.

Raises:

ClientException if any operation during files processing/resource creation fails.

ironicclient.v1.create_resources.create_single_chassis(client, **params)[source]

Call the client to create a chassis.

Parameters:
  • client – ironic client instance.

  • params – dictionary to be POSTed to /chassis endpoint, excluding “nodes” key.

Returns:

UUID of the created chassis or None in case of exception, and an exception, if it appears.

Raises:

InvalidAttribute, if some parameters passed to client’s create_method are invalid.

Raises:

ClientException, if the creation of the chassis fails.

ironicclient.v1.create_resources.create_single_handler(resource_type)[source]

Catch errors of the creation of a single resource.

This decorator appends an error (which is an instance of some client exception class) to the return value of the create_method, changing the return value from just UUID to (UUID, error), and does some exception handling.

Parameters:

resource_type – string value, the type of the resource being created, e.g. ‘node’, used purely for exception messages.

ironicclient.v1.create_resources.create_single_node(client, **params)[source]

Call the client to create a node.

Parameters:
  • client – ironic client instance.

  • params – dictionary to be POSTed to /nodes endpoint, excluding “ports” and “portgroups” keys.

Returns:

UUID of the created node or None in case of exception, and an exception, if it appears.

Raises:

InvalidAttribute, if some parameters passed to client’s create_method are invalid.

Raises:

ClientException, if the creation of the node fails.

ironicclient.v1.create_resources.create_single_port(client, **params)[source]

Call the client to create a port.

Parameters:
  • client – ironic client instance.

  • params – dictionary to be POSTed to /ports endpoint.

Returns:

UUID of the created port or None in case of exception, and an exception, if it appears.

Raises:

InvalidAttribute, if some parameters passed to client’s create_method are invalid.

Raises:

ClientException, if the creation of the port fails.

ironicclient.v1.create_resources.create_single_portgroup(client, **params)[source]

Call the client to create a port group.

Parameters:
  • client – ironic client instance.

  • params – dictionary to be POSTed to /portgroups endpoint, excluding “ports” key.

Returns:

UUID of the created port group or None in case of exception, and an exception, if it appears.

Raises:

InvalidAttribute, if some parameters passed to client’s create_method are invalid.

Raises:

ClientException, if the creation of the portgroup fails.

ironicclient.v1.create_resources.load_from_file(filename)[source]

Deserialize JSON or YAML from file.

Parameters:

filename – name of the file containing JSON or YAML.

Returns:

a dictionary deserialized from JSON or YAML.

Raises:

ClientException if the file can not be loaded or if its contents is not a valid JSON or YAML, or if the file extension is not supported.