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() self.snapshot_json = ParseSnapshotLsHw(snapshot_json).get_snapshot()
snapshot = self.build() snapshot = self.build()
snapshot.device.set_hid()
snapshot.device.binding.device.set_hid()
db.session.add(snapshot) db.session.add(snapshot)
snap_log = SnapshotsLog( snap_log = SnapshotsLog(

View File

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

View File

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