fix device set_hid

This commit is contained in:
Cayo Puigdefabregas 2022-11-16 17:40:35 +01:00
parent 81b28b2663
commit f0ffe27671
3 changed files with 5 additions and 0 deletions

View file

@ -58,6 +58,8 @@ class InventoryView(LoginMixin, SnapshotMixin):
self.snapshot_json = ParseSnapshotLsHw(snapshot_json).get_snapshot()
snapshot = self.build()
snapshot.device.set_hid()
snapshot.device.binding.device.set_hid()
db.session.add(snapshot)
snap_log = SnapshotsLog(

View file

@ -219,6 +219,8 @@ class SnapshotView(SnapshotMixin):
try:
self.snapshot_json = resource_def.schema.load(snapshot_json)
snapshot = self.build()
snapshot.device.set_hid()
snapshot.device.binding.device.set_hid()
except Exception as err:
txt = "{}".format(err)
self.errors(txt=txt, commit=True)

View file

@ -86,6 +86,7 @@ class Sync:
if motherboard:
for c in db_device.components:
if c.type == "Motherboard" and motherboard.hid != c.hid:
# import pdb; pdb.set_trace()
raise ValidationError(err_motherboard)
db_components, actions = OrderedSet(), OrderedSet()