diff options
author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2023-12-05 12:35:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-05 12:35:41 +0200 |
commit | df9bbe008b3b4ce4df3227867f32e60a71f2703d (patch) | |
tree | 9eb560f4c0e407559aba0ce2854a72c09f86bd80 /python | |
parent | a29aba5d92ad210b95226acfe756794d59068fc3 (diff) | |
parent | 692d2e362860255174076c08001ebe04b6035d3f (diff) | |
download | vyos-1x-df9bbe008b3b4ce4df3227867f32e60a71f2703d.tar.gz vyos-1x-df9bbe008b3b4ce4df3227867f32e60a71f2703d.zip |
Merge pull request #2571 from dmbaturin/https-api-keys-fix-crux
https: T5772: Move API key check to http-api.py
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/defaults.py | 2 | ||||
-rw-r--r-- | python/vyos/util.py | 19 |
2 files changed, 1 insertions, 20 deletions
diff --git a/python/vyos/defaults.py b/python/vyos/defaults.py index d7a4690ee..5d17b6b0c 100644 --- a/python/vyos/defaults.py +++ b/python/vyos/defaults.py @@ -37,7 +37,7 @@ api_data = { 'port' : '8080', 'strict' : 'false', 'debug' : 'false', - 'api_keys' : [], + 'api_keys' : [ ] } vyos_cert_data = { diff --git a/python/vyos/util.py b/python/vyos/util.py index bac327018..3ffd025b9 100644 --- a/python/vyos/util.py +++ b/python/vyos/util.py @@ -237,22 +237,3 @@ def process_named_running(name): if name in p.name(): return p.pid return None - -def dict_search(path, dict_object): - """ Traverse Python dictionary (dict_object) delimited by dot (.). - Return value of key if found, None otherwise. - This is faster implementation then jmespath.search('foo.bar', dict_object)""" - if not isinstance(dict_object, dict) or not path: - return None - - parts = path.split('.') - inside = parts[:-1] - if not inside: - if path not in dict_object: - return None - return dict_object[path] - c = dict_object - for p in parts[:-1]: - c = c.get(p, {}) - return c.get(parts[-1], None) - |