ironic.objects.trait module¶
- class ironic.objects.trait.Trait(context=None, **kwargs)[source]¶
Bases:
IronicObject- 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.Zelement is reserved for stable branch backports. The.Zis ignored for the purposes of triggering a backport, which means anything changed under a.Zmust be additive and non-destructive such that a node that knows aboutX.Ycan considerX.Y.Zequivalent.
- create(context=None)[source]¶
Create a Trait record in the DB.
- Parameters:
context – security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, 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.: Trait(context).
- Raises:
InvalidParameterValue if adding the trait would exceed the per-node traits limit.
- Raises:
NodeNotFound if the node no longer appears in the database.
- property created_at¶
- dbapi = <oslo_db.api.DBAPI object>¶
- classmethod destroy(context, node_id, trait)[source]¶
Delete the Trait from the DB.
- Parameters:
context – security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, 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.: Trait(context).
node_id – The id of a node.
trait – A trait string.
- Raises:
NodeNotFound if the node no longer appears in the database.
- Raises:
NodeTraitNotFound if the trait is not found.
- classmethod exists(context, node_id, trait)[source]¶
Check whether a Trait exists in the DB.
- Parameters:
context – security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, 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.: Trait(context).
node_id – The id of a node.
trait – A trait string.
- Returns:
True if the trait exists otherwise False.
- Raises:
NodeNotFound if the node no longer appears in the database.
- fields = {'created_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'node_id': String(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:fieldpairs.For example:
fields = { 'foo': obj_fields.IntegerField(), 'bar': obj_fields.StringField(), }
- property node_id¶
- property trait¶
- property updated_at¶
- class ironic.objects.trait.TraitList(*args, **kwargs)[source]¶
Bases:
IronicObjectListBase,IronicObject- 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.Zelement is reserved for stable branch backports. The.Zis ignored for the purposes of triggering a backport, which means anything changed under a.Zmust be additive and non-destructive such that a node that knows aboutX.Ycan considerX.Y.Zequivalent.
- classmethod create(context, node_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. Unfortunately, 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.: Trait(context).
node_id – The id of a node.
traits – List of Strings; traits to set.
- Raises:
InvalidParameterValue if adding the trait would exceed the per-node traits limit.
- Raises:
NodeNotFound if the node no longer appears in the database.
- property created_at¶
- dbapi = <oslo_db.api.DBAPI object>¶
- classmethod destroy(context, node_id)[source]¶
Delete all traits for the specified node.
- Parameters:
context – security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, 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.: Trait(context).
node_id – The id of a node.
- Raises:
NodeNotFound if the node 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:fieldpairs.For example:
fields = { 'foo': obj_fields.IntegerField(), 'bar': obj_fields.StringField(), }
- classmethod get_by_node_id(context, node_id)[source]¶
Return all traits for the specified node.
- Parameters:
context – security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, 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.: Trait(context).
node_id – The id of a node.
- Raises:
NodeNotFound if the node no longer appears in the database.
- property objects¶
- property updated_at¶