From e4203df44cd366536106b6b363eb97f967345a28 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 30 Sep 2024 17:48:38 +0200 Subject: [PATCH] fix parsing to old devicehub --- workbench-script.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/workbench-script.py b/workbench-script.py index 030845b..398c414 100644 --- a/workbench-script.py +++ b/workbench-script.py @@ -230,7 +230,7 @@ def exec_smart(disk): def smartctl(all_disks, disk=None): if disk: - return exec_smart(disk) + return [exec_smart(disk)] data_list = [] for disk in all_disks: @@ -250,7 +250,7 @@ def get_data(all_disks): hwinfo = 'sudo hwinfo --reallyall' dmidecode = 'sudo dmidecode' data = { - 'lshw': exec_cmd(lshw), + 'lshw': json.loads(exec_cmd(lshw) or "{}"), 'disks': smartctl(all_disks), 'hwinfo': exec_cmd(hwinfo), 'dmidecode': exec_cmd(dmidecode) @@ -298,7 +298,7 @@ def save_snapshot_in_disk(snapshot, path): # url = 'http://127.0.0.1:8000/api/snapshot/' def send_snapshot_to_devicehub(snapshot, token, url): headers = { - f"Authorization": "Basic {token}", + "Authorization": f"Bearer {token}", "Content-Type": "application/json" } try: