ironic_inspector.common.swift module

class ironic_inspector.common.swift.SwiftAPI[source]

Bases: object

API for communicating with Swift.

create_object(object, data, container=None, headers=None)[source]

Uploads a given string to Swift.

Parameters:
  • object – The name of the object in Swift

  • data – string data to put in the object

  • container – The name of the container for the object. Defaults to the value set in the configuration options.

  • headers – the headers for the object to pass to Swift

Returns:

The Swift UUID of the object

Raises:

utils.Error, if any operation with Swift fails.

get_object(object, container=None)[source]

Downloads a given object from Swift.

Parameters:
  • object – The name of the object in Swift

  • container – The name of the container for the object. Defaults to the value set in the configuration options.

Returns:

Swift object

Raises:

utils.Error, if the Swift operation fails.

ironic_inspector.common.swift.get_introspection_data(uuid, suffix=None)[source]

Downloads introspection data from Swift.

Parameters:
  • uuid – UUID of the Ironic node that the data came from

  • suffix – optional suffix to add to the underlying swift object name

Returns:

Swift object with the introspection data

ironic_inspector.common.swift.reset_swift_session()[source]

Reset the global session variable.

Mostly useful for unit tests.

ironic_inspector.common.swift.store_introspection_data(data, uuid, suffix=None)[source]

Uploads introspection data to Swift.

Parameters:
  • data – data to store in Swift

  • uuid – UUID of the Ironic node that the data came from

  • suffix – optional suffix to add to the underlying swift object name

Returns:

name of the Swift object that the data is stored in