diff options
author | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-09-22 17:42:33 +0200 |
---|---|---|
committer | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-09-29 13:01:28 +0200 |
commit | 4f3c66f04aebf3d571c3ba14f525b0e9a1dc1d55 (patch) | |
tree | 6dd430970784542b19a4d50f711e97dcb38d8a12 | |
parent | 328ead91682d0f0a9a918032b7de69de801954ec (diff) |
Fix ogServer deletion from the configuration file
Otherwise, users can not remove from the web a server declared in the
deprecated way.
-rw-r--r-- | ogcp/views.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ogcp/views.py b/ogcp/views.py index 862cc3e..9374606 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -1534,7 +1534,12 @@ def delete_server(server): with open(filename, 'r+') as file: config = json.load(file) - config['SERVERS'].remove(server_dict) + try: + config['SERVERS'].remove(server_dict) + except (KeyError, ValueError): + config.pop('IP') + config.pop('PORT') + config.pop('API_TOKEN') file.seek(0) json.dump(config, file, indent='\t') |