summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-02-24 09:24:38 -0600
committerJohn Estabrook <jestabro@vyos.io>2023-02-24 09:24:38 -0600
commitb0bc3ce9513fb23b22a8b1c53839370a12163410 (patch)
tree96b74f80c4fdcc0d57c601ff3a87cc4d244eb399
parenteaea1789f88082dae5b6cd12cc98bfc48221f35d (diff)
downloadvyos-1x-b0bc3ce9513fb23b22a8b1c53839370a12163410.tar.gz
vyos-1x-b0bc3ce9513fb23b22a8b1c53839370a12163410.zip
http-api: T5030: fix missing check on delete keys id tag or key value
-rwxr-xr-xsrc/conf_mode/http-api.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/conf_mode/http-api.py b/src/conf_mode/http-api.py
index 6328294c1..7e801eb26 100755
--- a/src/conf_mode/http-api.py
+++ b/src/conf_mode/http-api.py
@@ -79,9 +79,10 @@ def get_config(config=None):
# http-api.conf format for api_keys:
if 'keys' in api_dict:
api_dict['api_keys'] = []
- for el in list(api_dict['keys']['id']):
- key = api_dict['keys']['id'][el]['key']
- api_dict['api_keys'].append({'id': el, 'key': key})
+ for el in list(api_dict['keys'].get('id', {})):
+ key = api_dict['keys']['id'][el].get('key', '')
+ if key:
+ api_dict['api_keys'].append({'id': el, 'key': key})
del api_dict['keys']
# Do we run inside a VRF context?