From 7faa607131dd0124a5f1d4e804126e8063f1f9c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20S=C3=A1nchez=20Parra?= Date: Tue, 2 Nov 2021 16:33:25 +0100 Subject: [PATCH] Set default value on partition data parsing Otherwise, ogcp breaks when receiving an unknown disk table type, partition type or file system. --- ogcp/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ogcp/views.py b/ogcp/views.py index 5310376..0b5b934 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -101,11 +101,11 @@ def get_client_setup(ip): db_partitions = r.json()['partitions'] for partition in db_partitions: if partition['partition'] == 0: - partition['code'] = PART_SCHEME_CODES[partition['code']] + partition['code'] = PART_SCHEME_CODES.get(partition['code'], 'MSDOS') else: - partition['code'] = PART_TYPE_CODES[partition['code']] + partition['code'] = PART_TYPE_CODES.get(partition['code'], 'EMPTY') - partition['filesystem'] = FS_CODES[partition['filesystem']] + partition['filesystem'] = FS_CODES.get(partition['filesystem'], 'EMPTY') return db_partitions