Add identity helper property to CellMapping
This adds CellMapping.identity, a property to help with quick logging of a CellMapping. It's tempting to just log a a whole CellMapping object, but that can be bad due to the credentials stored within. This adds a convenient way to log the uuid or name-and-uuid of a CellMapping without having to replicate the is-name-set-or-none logic everywhere. Related to blueprint cells-aware-api Change-Id: Ie8eaf08e9f5bda56431358c40ccf187251be4542
This commit is contained in:
@@ -32,6 +32,13 @@ class CellMapping(base.NovaTimestampObject, base.NovaObject):
|
||||
'database_connection': fields.StringField(),
|
||||
}
|
||||
|
||||
@property
|
||||
def identity(self):
|
||||
if 'name' in self and self.name:
|
||||
return '%s(%s)' % (self.uuid, self.name)
|
||||
else:
|
||||
return self.uuid
|
||||
|
||||
@staticmethod
|
||||
def _from_db_object(context, cell_mapping, db_cell_mapping):
|
||||
for key in cell_mapping.fields:
|
||||
|
Reference in New Issue
Block a user