diff --git a/ereuse_devicehub/parser/models.py b/ereuse_devicehub/parser/models.py index 38ddbaf7..8caa0620 100644 --- a/ereuse_devicehub/parser/models.py +++ b/ereuse_devicehub/parser/models.py @@ -90,7 +90,9 @@ class SnapshotsLog(Thing): settings_version = self.snapshot.settings_version or '' settings_version = "".join([x[0] for x in settings_version.split(' ') if x]) - return "{} ({})".format(self.version, settings_version) + if settings_version: + return "{} ({})".format(self.version, settings_version) + return "{}".format(self.version) class PlaceholdersLog(Thing): diff --git a/ereuse_devicehub/parser/parser.py b/ereuse_devicehub/parser/parser.py index 91d0f103..9207c59a 100644 --- a/ereuse_devicehub/parser/parser.py +++ b/ereuse_devicehub/parser/parser.py @@ -343,6 +343,7 @@ class ParseSnapshotLsHw: "components": self.components, "uuid": snapshot['uuid'], "version": "14.0.0", + "settings_version": snapshot.get("settings_version"), "endTime": snapshot["timestamp"], "elapsed": 1, "sid": snapshot["sid"], diff --git a/ereuse_devicehub/parser/schemas.py b/ereuse_devicehub/parser/schemas.py index 1a84b8bc..fbdc671d 100644 --- a/ereuse_devicehub/parser/schemas.py +++ b/ereuse_devicehub/parser/schemas.py @@ -22,6 +22,7 @@ class Snapshot_lite(Thing): sid = String(required=True) type = String(required=True) timestamp = String(required=True) + settings_version = String(required=False) data = Nested(Snapshot_lite_data, required=True) @validates_schema diff --git a/ereuse_devicehub/templates/workbench/wbSettings.ini b/ereuse_devicehub/templates/workbench/wbSettings.ini index b28d64a0..213240c1 100644 --- a/ereuse_devicehub/templates/workbench/wbSettings.ini +++ b/ereuse_devicehub/templates/workbench/wbSettings.ini @@ -14,7 +14,7 @@ WB_SMART_TEST = short WB_ERASE = EraseBasic WB_ERASE_STEPS = 1 WB_ERASE_LEADING_ZEROS = False -VERSION = "Basic Erasure (BE)" +VERSION = Basic Erasure (BE) {% elif baseline_erease %} DH_HOST = {{ api_host }} @@ -28,11 +28,11 @@ WB_SMART_TEST = short WB_ERASE = EraseSectors WB_ERASE_STEPS = {{ erase_steps }} WB_ERASE_LEADING_ZEROS = True -VERSION = {%if erase_steps < 3 %}"Baseline Secure Erasure (BSE)"{% else %}"Enhanced Secure Erasure (ESE)"{% endif %} +VERSION = {%if erase_steps < 3 %}Baseline Secure Erasure (BSE){% else %}Enhanced Secure Erasure (ESE){% endif %} {% else %} SNAPSHOTS_PATH = /mnt LOGS_PATH = /mnt -VERSION = "Basic Metadata (BM)" +VERSION = Basic Metadata (BM) {% endif %} \ No newline at end of file diff --git a/ereuse_devicehub/workbench/__init__.py b/ereuse_devicehub/workbench/__init__.py index bd4530a4..7a54c4a2 100644 --- a/ereuse_devicehub/workbench/__init__.py +++ b/ereuse_devicehub/workbench/__init__.py @@ -1,14 +1,14 @@ isos = { "demo": { 'iso': "USODY_2022.8.0-Demo.iso", - 'url': 'http://releases.usody.com/demo/', + 'url': 'https://releases.usody.com/demo/', }, "register": { 'iso': "USODY_2022.8.0-beta.iso", - 'url': 'http://releases.usody.com/2022/', + 'url': 'https://releases.usody.com/2022/', }, "erease": { 'iso': "USODY_14.0.0.iso", - 'url': 'http://releases.usody.com/v14/', + 'url': 'https://releases.usody.com/v14/', }, } diff --git a/tests/files/2022-03-31_17h18m51s_ZQMPKKX51K67R68VO2X9RNZL08JPL_snapshot.json b/tests/files/2022-03-31_17h18m51s_ZQMPKKX51K67R68VO2X9RNZL08JPL_snapshot.json index 2a4c85a7..c8034fe6 100644 --- a/tests/files/2022-03-31_17h18m51s_ZQMPKKX51K67R68VO2X9RNZL08JPL_snapshot.json +++ b/tests/files/2022-03-31_17h18m51s_ZQMPKKX51K67R68VO2X9RNZL08JPL_snapshot.json @@ -6,6 +6,7 @@ "software": "Workbench", "version": "2022.03.00", "schema_api": "1.0.0", + "settings_version": "Basic Metadata", "data": { "lspci": "", "lshw": { diff --git a/tests/test_snapshot.py b/tests/test_snapshot.py index 9e408f26..2ee04e76 100644 --- a/tests/test_snapshot.py +++ b/tests/test_snapshot.py @@ -1413,3 +1413,18 @@ def test_bug_4028_components(user: UserClient): for c in m.Device.query.filter(): assert c.binding or c.placeholder + + +@pytest.mark.mvp +@pytest.mark.usefixtures(conftest.app_context.__name__) +def test_settings_version(user: UserClient): + """Tests when we have one computer and then we change the disk, then + the new disk need to have placeholder too.""" + s = file_json("2022-03-31_17h18m51s_ZQMPKKX51K67R68VO2X9RNZL08JPL_snapshot.json") + body, res = user.post(s, uri="/api/inventory/") + assert m.Computer.query.first().dhid == body['dhid'] + snapshot = Snapshot.query.first() + log = SnapshotsLog.query.first() + + assert log.get_version() == "14.0 (BM)" + assert snapshot.settings_version == "Basic Metadata"