diff --git a/.bin/Scripts/functions/hw_diags.py b/.bin/Scripts/functions/hw_diags.py index f5235111..4b018447 100644 --- a/.bin/Scripts/functions/hw_diags.py +++ b/.bin/Scripts/functions/hw_diags.py @@ -350,7 +350,7 @@ class DiskObj(): def get_smart_details(self): """Get data from smartctl.""" cmd = ['sudo', 'smartctl', '--all', '--json', self.path] - self.smartctl = get_json_from_command(cmd) + self.smartctl = get_json_from_command(cmd, check=False) # Check for attributes if KEY_NVME in self.smartctl: diff --git a/.bin/Scripts/functions/json.py b/.bin/Scripts/functions/json.py index b4527c0d..49481903 100644 --- a/.bin/Scripts/functions/json.py +++ b/.bin/Scripts/functions/json.py @@ -4,7 +4,7 @@ import json from functions.common import * -def get_json_from_command(cmd, ignore_errors=True): +def get_json_from_command(cmd, check=True, ignore_errors=True): """Capture JSON content from cmd output, returns dict. If the data can't be decoded then either an exception is raised @@ -17,7 +17,7 @@ def get_json_from_command(cmd, ignore_errors=True): errors = 'ignore' try: - result = run_program(cmd, encoding='utf-8', errors=errors) + result = run_program(cmd, check=check, encoding='utf-8', errors=errors) json_data = json.loads(result.stdout) except (subprocess.CalledProcessError, json.decoder.JSONDecodeError): if not ignore_errors: