The ironic_inspector.common.swift Module

class ironic_inspector.common.swift.SwiftAPI[source]

Bases: object

API for communicating with Swift.

create_object(object, data, container=’ironic-inspector’, 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.
  • 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=’ironic-inspector’)[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.
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.list_opts()[source]
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