Merge "Bug fix: Change object definition according to the newest DB."
This commit is contained in:
commit
216132787e
|
@ -175,7 +175,7 @@ class Connection(api.Connection):
|
||||||
query_prefix = model_query(context, models.AttachHandle)
|
query_prefix = model_query(context, models.AttachHandle)
|
||||||
filters = copy.deepcopy(filters)
|
filters = copy.deepcopy(filters)
|
||||||
|
|
||||||
exact_match_filter_names = ['uuid', 'id', 'deployable_id']
|
exact_match_filter_names = ['uuid', 'id', 'deployable_id', 'cpid_id']
|
||||||
|
|
||||||
# Filter the query
|
# Filter the query
|
||||||
query_prefix = self._exact_filter(models.AttachHandle, query_prefix,
|
query_prefix = self._exact_filter(models.AttachHandle, query_prefix,
|
||||||
|
@ -293,7 +293,7 @@ class Connection(api.Connection):
|
||||||
query_prefix = model_query(context, models.AttachHandle)
|
query_prefix = model_query(context, models.AttachHandle)
|
||||||
filters = copy.deepcopy(filters)
|
filters = copy.deepcopy(filters)
|
||||||
|
|
||||||
exact_match_filter_names = ['uuid', 'id', 'deployable_id']
|
exact_match_filter_names = ['uuid', 'id', 'device_id']
|
||||||
|
|
||||||
# Filter the query
|
# Filter the query
|
||||||
query_prefix = self._exact_filter(models.ControlpathID, query_prefix,
|
query_prefix = self._exact_filter(models.ControlpathID, query_prefix,
|
||||||
|
|
|
@ -36,14 +36,17 @@ class AttachHandle(base.CyborgObject, object_base.VersionedObjectDictCompat):
|
||||||
'id': object_fields.IntegerField(nullable=False),
|
'id': object_fields.IntegerField(nullable=False),
|
||||||
'uuid': object_fields.UUIDField(nullable=False),
|
'uuid': object_fields.UUIDField(nullable=False),
|
||||||
'deployable_id': object_fields.IntegerField(nullable=False),
|
'deployable_id': object_fields.IntegerField(nullable=False),
|
||||||
|
'cpid_id': object_fields.IntegerField(nullable=False),
|
||||||
'attach_type': object_fields.EnumField(valid_values=ATTACH_TYPE,
|
'attach_type': object_fields.EnumField(valid_values=ATTACH_TYPE,
|
||||||
nullable=False),
|
nullable=False),
|
||||||
# attach_info should be JSON here.
|
# attach_info should be JSON here.
|
||||||
'attach_info': object_fields.StringField(nullable=False)
|
'attach_info': object_fields.StringField(nullable=False),
|
||||||
|
'in_use': object_fields.BooleanField(nullable=False)
|
||||||
}
|
}
|
||||||
|
|
||||||
def create(self, context):
|
def create(self, context):
|
||||||
"""Create a AttachHandle record in the DB."""
|
"""Create a AttachHandle record in the DB."""
|
||||||
|
self.in_use = False
|
||||||
values = self.obj_get_changes()
|
values = self.obj_get_changes()
|
||||||
db_ah = self.dbapi.attach_handle_create(context, values)
|
db_ah = self.dbapi.attach_handle_create(context, values)
|
||||||
self._from_db_object(self, db_ah)
|
self._from_db_object(self, db_ah)
|
||||||
|
|
|
@ -35,7 +35,7 @@ class ControlpathID(base.CyborgObject, object_base.VersionedObjectDictCompat):
|
||||||
fields = {
|
fields = {
|
||||||
'id': object_fields.IntegerField(nullable=False),
|
'id': object_fields.IntegerField(nullable=False),
|
||||||
'uuid': object_fields.UUIDField(nullable=False),
|
'uuid': object_fields.UUIDField(nullable=False),
|
||||||
'deployable_id': object_fields.IntegerField(nullable=False),
|
'device_id': object_fields.IntegerField(nullable=False),
|
||||||
'cpid_type': object_fields.EnumField(valid_values=CPID_TYPE,
|
'cpid_type': object_fields.EnumField(valid_values=CPID_TYPE,
|
||||||
nullable=False),
|
nullable=False),
|
||||||
'cpid_info': object_fields.StringField(nullable=False)
|
'cpid_info': object_fields.StringField(nullable=False)
|
||||||
|
|
|
@ -87,6 +87,8 @@ def get_test_attach_handle(**kw):
|
||||||
'uuid': kw.get('uuid', '10efe63d-dfea-4a37-ad94-4116fba5098'),
|
'uuid': kw.get('uuid', '10efe63d-dfea-4a37-ad94-4116fba5098'),
|
||||||
'id': kw.get('id', 1),
|
'id': kw.get('id', 1),
|
||||||
'deployable_id': kw.get('deployable_id', 1),
|
'deployable_id': kw.get('deployable_id', 1),
|
||||||
|
'cpid_id': kw.get('cpid_id', 1),
|
||||||
|
'in_use': kw.get('in_use', False),
|
||||||
'attach_type': kw.get('attach_type', "PCI"),
|
'attach_type': kw.get('attach_type', "PCI"),
|
||||||
'attach_info': kw.get('attach_info', "attach_info"),
|
'attach_info': kw.get('attach_info', "attach_info"),
|
||||||
'created_at': kw.get('create_at', None),
|
'created_at': kw.get('create_at', None),
|
||||||
|
@ -98,7 +100,7 @@ def get_test_control_path(**kw):
|
||||||
return {
|
return {
|
||||||
'uuid': kw.get('uuid', '10efe63d-dfea-4a37-ad94-4116fba5098'),
|
'uuid': kw.get('uuid', '10efe63d-dfea-4a37-ad94-4116fba5098'),
|
||||||
'id': kw.get('id', 1),
|
'id': kw.get('id', 1),
|
||||||
'deployable_id': kw.get('deployable_id', 1),
|
'device_id': kw.get('device_id', 1),
|
||||||
'cpid_type': kw.get('cpid_type', "PCI"),
|
'cpid_type': kw.get('cpid_type', "PCI"),
|
||||||
'cpid_info': kw.get('cpid_info', "cpid_info"),
|
'cpid_info': kw.get('cpid_info', "cpid_info"),
|
||||||
'created_at': kw.get('create_at', None),
|
'created_at': kw.get('create_at', None),
|
||||||
|
|
Loading…
Reference in New Issue