save system uuid only for smbios >= 2.6

This commit is contained in:
Cayo Puigdefabregas 2022-06-16 17:58:32 +02:00
parent c43e7fb578
commit 88a164a9ee
1 changed files with 13 additions and 0 deletions

View File

@ -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: