bug fix uuid

This commit is contained in:
Cayo Puigdefabregas 2022-04-04 19:07:26 +02:00
parent cb5fb14c92
commit d592e2fb06
1 changed files with 10 additions and 8 deletions

View File

@ -1,5 +1,6 @@
import json import json
import logging import logging
import uuid
from enum import Enum, unique from enum import Enum, unique
from dmidecode import DMIParse from dmidecode import DMIParse
@ -412,9 +413,10 @@ class ParseSnapshotLsHw:
) )
self.errors(txt) self.errors(txt)
return 100 return 100
# return int(speed.split(" ")[0])
speed, units = speed.split(" ") speed, units = speed.split(" ")
return base2.Quantity(float(speed), units).to('MHz').m return float(speed)
# TODO @cayop is neccesary change models for accept sizes more high of speed or change to string
# return base2.Quantity(float(speed), units).to('MHz').m
def get_ram_slots(self): def get_ram_slots(self):
slots = 0 slots = 0
@ -433,17 +435,17 @@ class ParseSnapshotLsHw:
return 'SODIMM' if 'SODIMM' in channel else 'DIMM' return 'SODIMM' if 'SODIMM' in channel else 'DIMM'
def get_uuid(self): def get_uuid(self):
uuid = self.dmi.get("System")[0].get("UUID") dmi_uuid = self.dmi.get("System")[0].get("UUID")
try: try:
uuid.UUID(uuid) uuid.UUID(dmi_uuid)
except AttributeError as err: except (ValueError, AttributeError) as err:
self.errors("{}".format(err)) self.errors("{}".format(err))
txt = "Error: Snapshot: {uuid} have this uuid: {device}".format( txt = "Error: Snapshot: {uuid} have this uuid: {device}".format(
uuid=self.uuid, device=uuid uuid=self.uuid, device=dmi_uuid
) )
self.errors(txt) self.errors(txt)
uuid = None dmi_uuid = None
return uuid return dmi_uuid
def get_data_storage(self): def get_data_storage(self):