diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-07-06 12:21:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-06 12:21:46 +0200 |
commit | 511253635a9b67396788d24bacafd237594e0e12 (patch) | |
tree | 32a97fa2f6bf334f22d6a7e255f438af2777e3a8 /python/vyos/util.py | |
parent | 50b8d38abdb1525243a78896eff784744cfd5c44 (diff) | |
parent | a5cd877a0a4a43644a6d91e6b95fe938b9b2726b (diff) | |
download | vyos-1x-511253635a9b67396788d24bacafd237594e0e12.tar.gz vyos-1x-511253635a9b67396788d24bacafd237594e0e12.zip |
Merge pull request #911 from sarthurdev/pki_san
pki: ipsec: T3642: T1210: T2816: Add SANs to generated certificates, more IPSec remote-access features and fixes
Diffstat (limited to 'python/vyos/util.py')
-rw-r--r-- | python/vyos/util.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/python/vyos/util.py b/python/vyos/util.py index 8247ccb2d..171ab397f 100644 --- a/python/vyos/util.py +++ b/python/vyos/util.py @@ -440,7 +440,6 @@ def process_running(pid_file): pid = f.read().strip() return pid_exists(int(pid)) - def process_named_running(name): """ Checks if process with given name is running and returns its PID. If Process is not running, return None @@ -451,7 +450,6 @@ def process_named_running(name): return p.pid return None - def seconds_to_human(s, separator=""): """ Converts number of seconds passed to a human-readable interval such as 1w4d18h35m59s @@ -705,6 +703,19 @@ def dict_search(path, my_dict): c = c.get(p, {}) return c.get(parts[-1], None) +def dict_search_args(dict_object, *path): + # Traverse dictionary using variable arguments + # Added due to above function not allowing for '.' in the key names + # Example: dict_search_args(some_dict, 'key', 'subkey', 'subsubkey', ...) + if not isinstance(dict_object, dict) or not path: + return None + + for item in path: + if item not in dict_object: + return None + dict_object = dict_object[item] + return dict_object + def get_interface_config(interface): """ Returns the used encapsulation protocol for given interface. If interface does not exist, None is returned. |