Optimize deployble object module
Because the deployable object and the attribute object are independent, we should completely remove the attribute setting at the object level. When the attribute is removed, deployable can use the method of the base class like other objects (device, attach_handle). Therefore, this patch also removes the _from_db_object() method. Change-Id: Ieebc8242b68cbe1dfd4a3bc9081de2bb5f4075a7 Story: 2007369 Task: 38931
This commit is contained in:
parent
e9db6e8797
commit
e9b16df036
@ -65,7 +65,6 @@ class Deployable(base.CyborgObject, object_base.VersionedObjectDictCompat):
|
||||
db_dep = self.dbapi.deployable_create(context, values)
|
||||
self._from_db_object(self, db_dep)
|
||||
self.obj_reset_changes()
|
||||
del self.attributes_list[:]
|
||||
|
||||
@classmethod
|
||||
def get(cls, context, uuid):
|
||||
@ -145,20 +144,6 @@ class Deployable(base.CyborgObject, object_base.VersionedObjectDictCompat):
|
||||
|
||||
return obj_dpl_list
|
||||
|
||||
@staticmethod
|
||||
def _from_db_object(obj, db_obj):
|
||||
"""Converts a deployable to a formal object.
|
||||
|
||||
:param obj: An object of the class.
|
||||
:param db_obj: A DB model of the object
|
||||
:return: The object of the class with the database entity added
|
||||
"""
|
||||
for field in obj.fields:
|
||||
obj[field] = db_obj[field]
|
||||
obj.attributes_list = []
|
||||
|
||||
return obj
|
||||
|
||||
@classmethod
|
||||
def get_list_by_device_id(cls, context, device_id):
|
||||
dep_filter = {'device_id': device_id}
|
||||
|
Loading…
x
Reference in New Issue
Block a user