From 785f72692a26b14db433a98791d6fdda567fe511 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 30 Nov 2022 11:53:19 +0100 Subject: [PATCH 1/6] change settings template --- ereuse_devicehub/templates/workbench/wbSettings.ini | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ereuse_devicehub/templates/workbench/wbSettings.ini b/ereuse_devicehub/templates/workbench/wbSettings.ini index b711ae7d..90cdaed1 100644 --- a/ereuse_devicehub/templates/workbench/wbSettings.ini +++ b/ereuse_devicehub/templates/workbench/wbSettings.ini @@ -14,8 +14,8 @@ WB_SMART_TEST = short WB_ERASE = EraseBasic WB_ERASE_STEPS = 1 WB_ERASE_LEADING_ZEROS = False +VERSION = "Basic Erasure" -WB_DEBUG = True {% elif baseline_erease %} DH_HOST = {{ api_host }} DH_DATABASE = {{ schema }} @@ -28,6 +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"{% else %}"Enhanced Secure Erasure"{% endif %} -WB_DEBUG = True -{% endif %} +{% else %} +SNAPSHOTS_PATH = /mnt +LOGS_PATH = /mnt +VERSION = "Basic Metadata" + +{% endif %} \ No newline at end of file From 3f5ae9fefd86786575c822276b726148feebd3ef Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 30 Nov 2022 11:55:32 +0100 Subject: [PATCH 2/6] change settings template --- ereuse_devicehub/templates/workbench/wbSettings.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ereuse_devicehub/templates/workbench/wbSettings.ini b/ereuse_devicehub/templates/workbench/wbSettings.ini index 90cdaed1..b28d64a0 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" +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"{% else %}"Enhanced Secure Erasure"{% 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" +VERSION = "Basic Metadata (BM)" {% endif %} \ No newline at end of file From 18281c95e5d31af8a6ec4806cab6d5af45349771 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 30 Nov 2022 12:10:00 +0100 Subject: [PATCH 3/6] remove system_uuid --- ereuse_devicehub/templates/inventory/snapshots_list.html | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ereuse_devicehub/templates/inventory/snapshots_list.html b/ereuse_devicehub/templates/inventory/snapshots_list.html index 1804f364..ffe4a898 100644 --- a/ereuse_devicehub/templates/inventory/snapshots_list.html +++ b/ereuse_devicehub/templates/inventory/snapshots_list.html @@ -61,7 +61,6 @@ Snapshot UUID Version DHID - System UUID Status Type Upload Type Device @@ -97,9 +96,6 @@ {% endif %} - - {{ snap.get_system_uuid() }} - {{ snap.get_status() }} From 0a6f9e3bf423fa10ef378f86db7753fa25eacdf9 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 30 Nov 2022 12:54:11 +0100 Subject: [PATCH 4/6] add settings_version to schema --- ereuse_devicehub/resources/action/schemas.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ereuse_devicehub/resources/action/schemas.py b/ereuse_devicehub/resources/action/schemas.py index f24e2c83..da70c49a 100644 --- a/ereuse_devicehub/resources/action/schemas.py +++ b/ereuse_devicehub/resources/action/schemas.py @@ -453,6 +453,7 @@ class Snapshot(ActionWithOneDevice): 'Order is preserved, so the component num 0 when' 'submitting is the component num 0 when returning it back.', ) + settings_version = String(required=False) @validates_schema def validate_workbench_version(self, data: dict): From 7c6290bd89fd92370ce1d7d77b5553a11da0998c Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 30 Nov 2022 16:25:11 +0100 Subject: [PATCH 5/6] add settings version to snapshots model --- CHANGELOG.md | 1 + ...a388c_add_settings_version_to_snapshots.py | 35 +++++++++++++++++++ ereuse_devicehub/resources/action/models.py | 1 + 3 files changed, 37 insertions(+) create mode 100644 ereuse_devicehub/migrations/versions/af038a8a388c_add_settings_version_to_snapshots.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 89548604..ec1dff26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ml). ## testing +- [added] #414 add new vars in the settings file for wb. ## [2.5.0] - 2022-11-30 - [added] #407 erasure section with tabs in top. diff --git a/ereuse_devicehub/migrations/versions/af038a8a388c_add_settings_version_to_snapshots.py b/ereuse_devicehub/migrations/versions/af038a8a388c_add_settings_version_to_snapshots.py new file mode 100644 index 00000000..1b7b5a20 --- /dev/null +++ b/ereuse_devicehub/migrations/versions/af038a8a388c_add_settings_version_to_snapshots.py @@ -0,0 +1,35 @@ +"""add settings_version to snapshots + +Revision ID: af038a8a388c +Revises: 410aadae7652 +Create Date: 2022-11-30 16:21:05.768024 + +""" +import citext +import sqlalchemy as sa +from alembic import context, op + +# revision identifiers, used by Alembic. +revision = 'af038a8a388c' +down_revision = '410aadae7652' +branch_labels = None +depends_on = None + + +def get_inv(): + INV = context.get_x_argument(as_dictionary=True).get('inventory') + if not INV: + raise ValueError("Inventory value is not specified") + return INV + + +def upgrade(): + op.add_column( + 'snapshot', + sa.Column('settings_version', citext.CIText(), nullable=True), + schema=f'{get_inv()}', + ) + + +def downgrade(): + op.drop_column('snapshot', 'settings_version', schema=f'{get_inv()}') diff --git a/ereuse_devicehub/resources/action/models.py b/ereuse_devicehub/resources/action/models.py index 87a9d392..ac38fad1 100644 --- a/ereuse_devicehub/resources/action/models.py +++ b/ereuse_devicehub/resources/action/models.py @@ -676,6 +676,7 @@ class Snapshot(JoinedWithOneDeviceMixin, ActionWithOneDevice): of time it took to complete. """ sid = Column(CIText(), nullable=True) + settings_version = Column(CIText(), nullable=True) is_server_erase = Column(Boolean(), nullable=True) def get_last_lifetimes(self): From a2626a0b587ddfe7cba2ae5b9c3a271f6ac67c4d Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 30 Nov 2022 16:46:10 +0100 Subject: [PATCH 6/6] add settings version to version column in snapshots log --- ereuse_devicehub/parser/models.py | 8 ++++++++ ereuse_devicehub/templates/inventory/snapshots_list.html | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ereuse_devicehub/parser/models.py b/ereuse_devicehub/parser/models.py index 6d8cdb4e..38ddbaf7 100644 --- a/ereuse_devicehub/parser/models.py +++ b/ereuse_devicehub/parser/models.py @@ -84,6 +84,14 @@ class SnapshotsLog(Thing): except AttributeError: return '' + def get_version(self): + if not self.snapshot: + return self.version + 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) + class PlaceholdersLog(Thing): """A Placeholder log.""" diff --git a/ereuse_devicehub/templates/inventory/snapshots_list.html b/ereuse_devicehub/templates/inventory/snapshots_list.html index ffe4a898..126d3ac3 100644 --- a/ereuse_devicehub/templates/inventory/snapshots_list.html +++ b/ereuse_devicehub/templates/inventory/snapshots_list.html @@ -87,7 +87,7 @@ {% endif %} - {{ snap.version }} + {{ snap.get_version() }} {% if snap.get_device() %}