From 88a164a9eef65c6be1fdfd3544c569c1bdede41e Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 16 Jun 2022 17:58:32 +0200 Subject: [PATCH] save system uuid only for smbios >= 2.6 --- ereuse_devicehub/resources/action/views/snapshot.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ereuse_devicehub/resources/action/views/snapshot.py b/ereuse_devicehub/resources/action/views/snapshot.py index 1aaf3985..1477835c 100644 --- a/ereuse_devicehub/resources/action/views/snapshot.py +++ b/ereuse_devicehub/resources/action/views/snapshot.py @@ -117,11 +117,24 @@ class SnapshotMixin: return snapshot + def get_old_smbios_version(self, debug): + capabilities = debug.get('lshw', {}).get('capabilities', {}) + for x in capabilities.values(): + if "SMBIOS version" in x: + e = x.split("SMBIOS version ")[1].split(".") + if int(e[0]) < 3 and int(e[1]) < 6: + self.errors(txt=x) + return True + return False + def get_uuid(self, debug): if not debug or not isinstance(debug, dict): self.errors(txt="There is not uuid") return + if self.get_old_smbios_version(debug): + return + hw_uuid = debug.get('lshw', {}).get('configuration', {}).get('uuid') if not hw_uuid: