ironic.objects.runbook module

class ironic.objects.runbook.Runbook(context=None, **kwargs)[source]

Bases: IronicObject, VersionedObjectDictCompat

VERSION = '1.2'

Object version field

Each service has its set of objects, each with a version attached. When a client attempts to call an object method, the server checks to see if the version of that object matches (in a compatible way) its object implementation. If so, cool, and if not, fail.

This version is allowed to have three parts, X.Y.Z, where the .Z element is reserved for stable branch backports. The .Z is ignored for the purposes of triggering a backport, which means anything changed under a .Z must be additive and non-destructive such that a node that knows about X.Y can consider X.Y.Z equivalent.

create(context=None)[source]

Create a Runbook record in the DB.

Parameters:

context – security context. NOTE: This should only be used internally by the indirection_api, but, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: Runbook(context).

Raises:

RunbookDuplicateName if a runbook with the same name exists.

Raises:

RunbookAlreadyExists if a runbook with the same UUID exists.

property created_at
dbapi = <oslo_db.api.DBAPI object>
property description
destroy()[source]

Delete the Runbook from the DB.

Parameters:

context – security context. NOTE: This should only be used internally by the indirection_api, but, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: Runbook(context).

Raises:

RunbookNotFound if the runbook no longer appears in the database.

property disable_ramdisk
property extra
fields = {'created_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'description': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'disable_ramdisk': Boolean(default=False,nullable=False), 'extra': FlexibleDict(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'id': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'name': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'owner': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'public': Boolean(default=False,nullable=False), 'steps': List(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'traits': List(default=[],nullable=False), 'updated_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'uuid': UUID(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False)}

The fields present in this object as key:field pairs.

For example:

fields = {
    'foo': obj_fields.IntegerField(),
    'bar': obj_fields.StringField(),
}
classmethod get_by_id(context, runbook_id)[source]

Find a runbook based on its integer ID.

Parameters:
  • context – security context. NOTE: This should only be used internally by the indirection_api, but, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: Runbook(context).

  • runbook_id – The ID of a runbook.

Raises:

RunbookNotFound if the runbook no longer appears in the database.

Returns:

a Runbook object.

classmethod get_by_name(context, name)[source]

Find a runbook based on its name.

Parameters:
  • context – security context. NOTE: This should only be used internally by the indirection_api, but, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: Runbook(context).

  • name – The name of a runbook.

Raises:

RunbookNotFound if the runbook no longer appears in the database.

Returns:

a Runbook object.

classmethod get_by_uuid(context, uuid)[source]

Find a runbook based on its UUID.

Parameters:
  • context – security context. NOTE: This should only be used internally by the indirection_api, but, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: Runbook(context).

  • uuid – The UUID of a runbook.

Raises:

RunbookNotFound if the runbook no longer appears in the database.

Returns:

a Runbook object.

property id
classmethod list(context, limit=None, marker=None, sort_key=None, sort_dir=None, filters=None)[source]

Return a list of Runbook objects.

Parameters:
  • context – security context. NOTE: This should only be used internally by the indirection_api, but, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: Runbook(context).

  • limit – maximum number of resources to return in a single result.

  • marker – pagination marker for large data sets.

  • sort_key – column to sort results by.

  • sort_dir – direction to sort. “asc” or “desc”.

  • filters – Filters to apply.

Returns:

a list of Runbook objects.

classmethod list_by_names(context, names)[source]

Return a list of Runbook objects matching a set of names.

Parameters:
  • context – security context. NOTE: This should only be used internally by the indirection_api, but, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: Runbook(context).

  • names – a list of names to filter by.

Returns:

a list of Runbook objects.

property name
obj_make_compatible(primitive, target_version)[source]

Make an object representation compatible with a target version.

Parameters:
  • primitive – The result of self.obj_to_primitive().

  • target_version – The version string of the target version.

property owner
property public
refresh(context=None)[source]

Loads updates for this runbook.

Loads a runbook with the same uuid from the database and checks for updated attributes. Updates are applied from the loaded template column by column, if there are any updates.

Parameters:

context – Security context. NOTE: This should only be used internally by the indirection_api, but, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: Port(context)

Raises:

RunbookNotFound if the runbook no longer appears in the database.

save(context=None)[source]

Save updates to this Runbook.

Column-wise updates will be made based on the result of self.what_changed().

Parameters:

context – Security context. NOTE: This should only be used internally by the indirection_api, but, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: Runbook(context)

Raises:

RunbookDuplicateName if a runbook with the same name exists.

Raises:

RunbookNotFound if the runbook does not exist.

property steps
property traits
property updated_at
property uuid
class ironic.objects.runbook.RunbookCRUDNotification(context=None, **kwargs)[source]

Bases: NotificationBase

Notification emitted on runbook API operations.

VERSION = '1.0'

Object version field

Each service has its set of objects, each with a version attached. When a client attempts to call an object method, the server checks to see if the version of that object matches (in a compatible way) its object implementation. If so, cool, and if not, fail.

This version is allowed to have three parts, X.Y.Z, where the .Z element is reserved for stable branch backports. The .Z is ignored for the purposes of triggering a backport, which means anything changed under a .Z must be additive and non-destructive such that a node that knows about X.Y can consider X.Y.Z equivalent.

property created_at
property event_type
fields = {'created_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'event_type': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'level': NotificationLevel(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False,valid_values=('debug', 'info', 'warning', 'error', 'critical')), 'payload': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'publisher': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'updated_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True)}

The fields present in this object as key:field pairs.

For example:

fields = {
    'foo': obj_fields.IntegerField(),
    'bar': obj_fields.StringField(),
}
property level
property payload
property publisher
property updated_at
class ironic.objects.runbook.RunbookCRUDPayload(runbook, **kwargs)[source]

Bases: NotificationPayloadBase

SCHEMA = {'created_at': ('runbook', 'created_at'), 'description': ('runbook', 'description'), 'disable_ramdisk': ('runbook', 'disable_ramdisk'), 'extra': ('runbook', 'extra'), 'name': ('runbook', 'name'), 'owner': ('runbook', 'owner'), 'public': ('runbook', 'public'), 'steps': ('runbook', 'steps'), 'traits': ('runbook', 'traits'), 'updated_at': ('runbook', 'updated_at'), 'uuid': ('runbook', 'uuid')}
VERSION = '1.1'

Object version field

Each service has its set of objects, each with a version attached. When a client attempts to call an object method, the server checks to see if the version of that object matches (in a compatible way) its object implementation. If so, cool, and if not, fail.

This version is allowed to have three parts, X.Y.Z, where the .Z element is reserved for stable branch backports. The .Z is ignored for the purposes of triggering a backport, which means anything changed under a .Z must be additive and non-destructive such that a node that knows about X.Y can consider X.Y.Z equivalent.

property created_at
property description
property disable_ramdisk
property extra
fields = {'created_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'description': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'disable_ramdisk': Boolean(default=False,nullable=False), 'extra': FlexibleDict(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'name': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'owner': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'public': Boolean(default=False,nullable=False), 'steps': List(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'traits': List(default=[],nullable=False), 'updated_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'uuid': UUID(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False)}

The fields present in this object as key:field pairs.

For example:

fields = {
    'foo': obj_fields.IntegerField(),
    'bar': obj_fields.StringField(),
}
property name
property owner
property public
property steps
property traits
property updated_at
property uuid
class ironic.objects.runbook.RunbookTrait(context=None, **kwargs)[source]

Bases: IronicObject

VERSION = '1.0'

Object version field

Each service has its set of objects, each with a version attached. When a client attempts to call an object method, the server checks to see if the version of that object matches (in a compatible way) its object implementation. If so, cool, and if not, fail.

This version is allowed to have three parts, X.Y.Z, where the .Z element is reserved for stable branch backports. The .Z is ignored for the purposes of triggering a backport, which means anything changed under a .Z must be additive and non-destructive such that a node that knows about X.Y can consider X.Y.Z equivalent.

create(context=None)[source]

Create a RunbookTrait record in the DB.

Parameters:

context – security context. NOTE: This should only be used internally by the indirection_api. A context should be set when instantiating the object, e.g.: RunbookTrait(context).

Raises:

RunbookNotFound if the runbook no longer appears in the database.

property created_at
dbapi = <oslo_db.api.DBAPI object>
classmethod destroy(context, runbook_id, trait)[source]

Delete the RunbookTrait from the DB.

Parameters:
  • context – security context. NOTE: This should only be used internally by the indirection_api. A context should be set when instantiating the object, e.g.: RunbookTrait(context).

  • runbook_id – The id of a runbook.

  • trait – A trait string.

Raises:

RunbookNotFound if the runbook no longer appears in the database.

Raises:

RunbookTraitNotFound if the trait is not found.

classmethod exists(context, runbook_id, trait)[source]

Check whether a RunbookTrait exists in the DB.

Parameters:
  • context – security context. NOTE: This should only be used internally by the indirection_api. A context should be set when instantiating the object, e.g.: RunbookTrait(context).

  • runbook_id – The id of a runbook.

  • trait – A trait string.

Returns:

True if the trait exists otherwise False.

Raises:

RunbookNotFound if the runbook no longer appears in the database.

fields = {'created_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'runbook_id': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'trait': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'updated_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True)}

The fields present in this object as key:field pairs.

For example:

fields = {
    'foo': obj_fields.IntegerField(),
    'bar': obj_fields.StringField(),
}
property runbook_id
property trait
property updated_at
class ironic.objects.runbook.RunbookTraitList(*args, **kwargs)[source]

Bases: IronicObjectListBase, IronicObject

VERSION = '1.0'

Object version field

Each service has its set of objects, each with a version attached. When a client attempts to call an object method, the server checks to see if the version of that object matches (in a compatible way) its object implementation. If so, cool, and if not, fail.

This version is allowed to have three parts, X.Y.Z, where the .Z element is reserved for stable branch backports. The .Z is ignored for the purposes of triggering a backport, which means anything changed under a .Z must be additive and non-destructive such that a node that knows about X.Y can consider X.Y.Z equivalent.

classmethod create(context, runbook_id, traits)[source]

Replace all existing traits with the specified list.

Parameters:
  • context – security context. NOTE: This should only be used internally by the indirection_api. A context should be set when instantiating the object, e.g.: RunbookTrait(context).

  • runbook_id – The id of a runbook.

  • traits – List of Strings; traits to set.

Raises:

RunbookNotFound if the runbook no longer appears in the database.

property created_at
dbapi = <oslo_db.api.DBAPI object>
classmethod destroy(context, runbook_id)[source]

Delete all traits for the specified runbook.

Parameters:
  • context – security context. NOTE: This should only be used internally by the indirection_api. A context should be set when instantiating the object, e.g.: RunbookTrait(context).

  • runbook_id – The id of a runbook.

Raises:

RunbookNotFound if the runbook no longer appears in the database.

fields = {'created_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'objects': List(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'updated_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True)}

The fields present in this object as key:field pairs.

For example:

fields = {
    'foo': obj_fields.IntegerField(),
    'bar': obj_fields.StringField(),
}
classmethod get_by_runbook_id(context, runbook_id)[source]

Return all traits for the specified runbook.

Parameters:
  • context – security context. NOTE: This should only be used internally by the indirection_api. A context should be set when instantiating the object, e.g.: RunbookTrait(context).

  • runbook_id – The id of a runbook.

Raises:

RunbookNotFound if the runbook no longer appears in the database.

get_trait_names()[source]

Return a list of names of the traits in this list.

property objects
property updated_at