diff options
author | Javier Sánchez Parra <jsanchez@soleta.eu> | 2021-11-02 16:33:25 +0100 |
---|---|---|
committer | Javier Sánchez Parra <jsanchez@soleta.eu> | 2021-11-02 16:48:06 +0100 |
commit | 7faa607131dd0124a5f1d4e804126e8063f1f9c9 (patch) | |
tree | b5f9aaaabfca9d0c802a593cc85ce91315f96767 | |
parent | cbeafea273906d55b01d37b2803af189d6813d2d (diff) |
Set default value on partition data parsing
Otherwise, ogcp breaks when receiving an unknown disk table type,
partition type or file system.
-rw-r--r-- | ogcp/views.py | 6 |
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 |