fixing system uuid as non physical property
This commit is contained in:
parent
93545ad01b
commit
18e051596c
|
@ -197,6 +197,7 @@ class Sync:
|
||||||
).one()
|
).one()
|
||||||
if db_device and db_device.allocated:
|
if db_device and db_device.allocated:
|
||||||
raise ResourceNotFound('device is actually allocated {}'.format(device))
|
raise ResourceNotFound('device is actually allocated {}'.format(device))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
tags = {
|
tags = {
|
||||||
Tag.from_an_id(tag.id).one() for tag in device.tags
|
Tag.from_an_id(tag.id).one() for tag in device.tags
|
||||||
|
@ -264,6 +265,13 @@ class Sync:
|
||||||
if value is not None:
|
if value is not None:
|
||||||
setattr(db_device, field_name, value)
|
setattr(db_device, field_name, value)
|
||||||
|
|
||||||
|
# if device.system_uuid and db_device.system_uuid and device.system_uuid != db_device.system_uuid:
|
||||||
|
# TODO @cayop send error to sentry.io
|
||||||
|
# there are 2 computers duplicate get db_device for hid
|
||||||
|
|
||||||
|
if hasattr(device, 'system_uuid') and device.system_uuid:
|
||||||
|
db_device.system_uuid = device.system_uuid
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def add_remove(device: Computer, components: Set[Component]) -> OrderedSet:
|
def add_remove(device: Computer, components: Set[Component]) -> OrderedSet:
|
||||||
"""Generates the Add and Remove actions (but doesn't add them to
|
"""Generates the Add and Remove actions (but doesn't add them to
|
||||||
|
|
|
@ -102,6 +102,10 @@ def test_wb11_to_wb11_with_uuid_api(user: UserClient):
|
||||||
snapshot_11['uuid'] = '0973fda0-589a-11eb-ae93-0242ac130003'
|
snapshot_11['uuid'] = '0973fda0-589a-11eb-ae93-0242ac130003'
|
||||||
user.post(snapshot_11, res=Snapshot)
|
user.post(snapshot_11, res=Snapshot)
|
||||||
|
|
||||||
|
assert (
|
||||||
|
snapshot_11['debug']['lshw']['configuration']['uuid']
|
||||||
|
== '364ee69c-9c82-9cb1-2111-88ae1da6f3d0'
|
||||||
|
)
|
||||||
assert Computer.query.count() == 1
|
assert Computer.query.count() == 1
|
||||||
device = Computer.query.one()
|
device = Computer.query.one()
|
||||||
assert device.hid == 'laptop-acer-aohappy-lusea0d010038879a01601-88:ae:1d:a6:f3:d0'
|
assert device.hid == 'laptop-acer-aohappy-lusea0d010038879a01601-88:ae:1d:a6:f3:d0'
|
||||||
|
|
Reference in a new issue