diff --git a/ereuse_devicehub/parser/parser.py b/ereuse_devicehub/parser/parser.py index 357a7098..7f4f0dc8 100644 --- a/ereuse_devicehub/parser/parser.py +++ b/ereuse_devicehub/parser/parser.py @@ -8,6 +8,7 @@ from dmidecode import DMIParse from ereuse_devicehub.parser import base2 from ereuse_devicehub.parser.computer import Computer from ereuse_devicehub.parser.models import SnapshotErrors +from ereuse_devicehub.resources.action.schemas import Snapshot from ereuse_devicehub.resources.enums import Severity logger = logging.getLogger(__name__) @@ -40,6 +41,9 @@ class ParseSnapshot: "wbid": snapshot["wbid"], } + def get_snapshot(self): + return Snapshot().load(self.snapshot_json) + def set_basic_datas(self): self.device['manufacturer'] = self.dmi.manufacturer() self.device['model'] = self.dmi.model() @@ -336,17 +340,20 @@ class ParseSnapshotLsHw: self.set_components() self.snapshot_json = { + "type": "Snapshot", "device": self.device, "software": "Workbench", "components": self.components, "uuid": snapshot['uuid'], - "type": snapshot['type'], "version": snapshot["version"], "endTime": snapshot["timestamp"], "elapsed": 1, "wbid": snapshot["wbid"], } + def get_snapshot(self): + return Snapshot().load(self.snapshot_json) + def parse_hwinfo(self): hw_blocks = self.hwinfo_raw.split("\n\n") return [x.split("\n") for x in hw_blocks]