summaryrefslogtreecommitdiffstats
path: root/ogcp
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2021-11-02 16:33:25 +0100
committerJavier Sánchez Parra <jsanchez@soleta.eu>2021-11-02 16:48:06 +0100
commit7faa607131dd0124a5f1d4e804126e8063f1f9c9 (patch)
treeb5f9aaaabfca9d0c802a593cc85ce91315f96767 /ogcp
parentcbeafea273906d55b01d37b2803af189d6813d2d (diff)
Set default value on partition data parsing
Otherwise, ogcp breaks when receiving an unknown disk table type, partition type or file system.
Diffstat (limited to 'ogcp')
-rw-r--r--ogcp/views.py6
1 files 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