diff options
| author | Christian Breunig <christian@breunig.cc> | 2023-02-24 17:37:26 +0100 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-24 17:37:26 +0100 | 
| commit | 42e758dde8e084ebb336f995b9b0af3bf4a82d96 (patch) | |
| tree | aa133a062bdc07b83d97335469df456aeab9ee9f /src/conf_mode/http-api.py | |
| parent | b49f27ce14b7ab3f2b6899780484f32fcfd2072d (diff) | |
| parent | b0bc3ce9513fb23b22a8b1c53839370a12163410 (diff) | |
| download | vyos-1x-42e758dde8e084ebb336f995b9b0af3bf4a82d96.tar.gz vyos-1x-42e758dde8e084ebb336f995b9b0af3bf4a82d96.zip  | |
Merge pull request #1850 from jestabro/T5030
http-api: T5030: fix missing check on delete keys id tag or key value
Diffstat (limited to 'src/conf_mode/http-api.py')
| -rwxr-xr-x | src/conf_mode/http-api.py | 7 | 
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?  | 
