From 86446a268c57ee167abc5e935030153e594ddac2 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 14 Jun 2022 10:46:21 +0200 Subject: [PATCH] fix uuid in device not computer --- ereuse_devicehub/resources/action/views/snapshot.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ereuse_devicehub/resources/action/views/snapshot.py b/ereuse_devicehub/resources/action/views/snapshot.py index 09d75f99..59739655 100644 --- a/ereuse_devicehub/resources/action/views/snapshot.py +++ b/ereuse_devicehub/resources/action/views/snapshot.py @@ -118,7 +118,7 @@ class SnapshotMixin: return snapshot def get_uuid(self, debug): - if not debug: + if not debug or not isinstance(debug, dict): self.errors(txt="There is not uuid") return @@ -167,7 +167,9 @@ class SnapshotView(SnapshotMixin): self.version = snapshot_json.get('version') self.uuid = snapshot_json.get('uuid') self.sid = None - self.get_uuid(snapshot_json.pop('debug', None)) + system_uuid = self.get_uuid(snapshot_json.pop('debug', None)) + if system_uuid: + snapshot_json['device']['uuid'] = system_uuid try: self.snapshot_json = resource_def.schema.load(snapshot_json)