fix version in snaposhotslog
This commit is contained in:
parent
1698f35e3d
commit
3d73e1a368
|
@ -422,7 +422,7 @@ class Computer(Device):
|
||||||
self._ram = None
|
self._ram = None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, lshw, hwinfo_raw, uuid=None, sid=None):
|
def run(cls, lshw, hwinfo_raw, uuid=None, sid=None, version=None):
|
||||||
"""
|
"""
|
||||||
Gets hardware information from the computer and its components,
|
Gets hardware information from the computer and its components,
|
||||||
like serial numbers or model names, and benchmarks them.
|
like serial numbers or model names, and benchmarks them.
|
||||||
|
@ -447,18 +447,24 @@ class Computer(Device):
|
||||||
txt = "Error: Snapshot: {uuid}, sid: {sid}, type_error: {type}, error: {error}".format(
|
txt = "Error: Snapshot: {uuid}, sid: {sid}, type_error: {type}, error: {error}".format(
|
||||||
uuid=uuid, sid=sid, type=err.__class__, error=err
|
uuid=uuid, sid=sid, type=err.__class__, error=err
|
||||||
)
|
)
|
||||||
cls.errors(txt, uuid=uuid, sid=sid)
|
cls.errors(txt, uuid=uuid, sid=sid, version=version)
|
||||||
|
|
||||||
return computer, components
|
return computer, components
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def errors(cls, txt=None, uuid=None, sid=None, severity=Severity.Error):
|
def errors(
|
||||||
|
cls, txt=None, uuid=None, sid=None, version=None, severity=Severity.Error
|
||||||
|
):
|
||||||
if not txt:
|
if not txt:
|
||||||
return
|
return
|
||||||
|
|
||||||
logger.error(txt)
|
logger.error(txt)
|
||||||
error = SnapshotsLog(
|
error = SnapshotsLog(
|
||||||
description=txt, snapshot_uuid=uuid, severity=severity, sid=sid
|
description=txt,
|
||||||
|
snapshot_uuid=uuid,
|
||||||
|
severity=severity,
|
||||||
|
sid=sid,
|
||||||
|
version=version,
|
||||||
)
|
)
|
||||||
error.save()
|
error.save()
|
||||||
|
|
||||||
|
|
|
@ -320,6 +320,7 @@ class ParseSnapshotLsHw:
|
||||||
self.default = default
|
self.default = default
|
||||||
self.uuid = snapshot.get("uuid")
|
self.uuid = snapshot.get("uuid")
|
||||||
self.sid = snapshot.get("sid")
|
self.sid = snapshot.get("sid")
|
||||||
|
self.version = snapshot.get("version")
|
||||||
self.dmidecode_raw = snapshot["data"]["dmidecode"]
|
self.dmidecode_raw = snapshot["data"]["dmidecode"]
|
||||||
self.smart = snapshot["data"]["smart"]
|
self.smart = snapshot["data"]["smart"]
|
||||||
self.hwinfo_raw = snapshot["data"]["hwinfo"]
|
self.hwinfo_raw = snapshot["data"]["hwinfo"]
|
||||||
|
@ -362,7 +363,7 @@ class ParseSnapshotLsHw:
|
||||||
def set_basic_datas(self):
|
def set_basic_datas(self):
|
||||||
try:
|
try:
|
||||||
pc, self.components_obj = Computer.run(
|
pc, self.components_obj = Computer.run(
|
||||||
self.lshw, self.hwinfo_raw, self.uuid, self.sid
|
self.lshw, self.hwinfo_raw, self.uuid, self.sid, self.version
|
||||||
)
|
)
|
||||||
pc = pc.dump()
|
pc = pc.dump()
|
||||||
minimum_hid = None in [pc['manufacturer'], pc['model'], pc['serialNumber']]
|
minimum_hid = None in [pc['manufacturer'], pc['model'], pc['serialNumber']]
|
||||||
|
@ -546,13 +547,17 @@ class ParseSnapshotLsHw:
|
||||||
|
|
||||||
return action
|
return action
|
||||||
|
|
||||||
def errors(self, txt=None, severity=Severity.Info):
|
def errors(self, txt=None, severity=Severity.Error):
|
||||||
if not txt:
|
if not txt:
|
||||||
return self._errors
|
return self._errors
|
||||||
|
|
||||||
logger.error(txt)
|
logger.error(txt)
|
||||||
self._errors.append(txt)
|
self._errors.append(txt)
|
||||||
error = SnapshotsLog(
|
error = SnapshotsLog(
|
||||||
description=txt, snapshot_uuid=self.uuid, severity=severity, sid=self.sid
|
description=txt,
|
||||||
|
snapshot_uuid=self.uuid,
|
||||||
|
severity=severity,
|
||||||
|
sid=self.sid,
|
||||||
|
version=self.version,
|
||||||
)
|
)
|
||||||
error.save()
|
error.save()
|
||||||
|
|
Reference in New Issue