diff options
author | Christian Breunig <christian@breunig.cc> | 2024-01-04 11:17:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-04 11:17:27 +0100 |
commit | 598fed91068401d5ed259ea742820248d851d246 (patch) | |
tree | 14ad877fe86882f8325f6bda83471197aecc6c45 /python/vyos/config.py | |
parent | 1cc70ce273cbddb5ea9eb4148808c6c2aaf3d28f (diff) | |
parent | 706fdbb234202723e02f93ad8eb724649181a60a (diff) | |
download | vyos-1x-598fed91068401d5ed259ea742820248d851d246.tar.gz vyos-1x-598fed91068401d5ed259ea742820248d851d246.zip |
Merge pull request #2751 from vyos/mergify/bp/sagitta/pr-2750
configdict: T5894: add get_config_dict() flag with_pki (backport #2750)
Diffstat (limited to 'python/vyos/config.py')
-rw-r--r-- | python/vyos/config.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/python/vyos/config.py b/python/vyos/config.py index 0ca41718f..ca7b035e5 100644 --- a/python/vyos/config.py +++ b/python/vyos/config.py @@ -29,7 +29,7 @@ There are multiple types of config tree nodes in VyOS, each requires its own set of operations. *Leaf nodes* (such as "address" in interfaces) can have values, but cannot -have children. +have children. Leaf nodes can have one value, multiple values, or no values at all. For example, "system host-name" is a single-value leaf node, @@ -258,7 +258,9 @@ class Config(object): def get_config_dict(self, path=[], effective=False, key_mangling=None, get_first_key=False, no_multi_convert=False, no_tag_node_value_mangle=False, - with_defaults=False, with_recursive_defaults=False): + with_defaults=False, + with_recursive_defaults=False, + with_pki=False): """ Args: path (str list): Configuration tree path, can be empty @@ -274,6 +276,7 @@ class Config(object): del kwargs['no_multi_convert'] del kwargs['with_defaults'] del kwargs['with_recursive_defaults'] + del kwargs['with_pki'] lpath = self._make_path(path) root_dict = self.get_cached_root_dict(effective) @@ -298,6 +301,13 @@ class Config(object): else: conf_dict = ConfigDict(conf_dict) + if with_pki and conf_dict: + pki_dict = self.get_config_dict(['pki'], key_mangling=('-', '_'), + no_tag_node_value_mangle=True, + get_first_key=True) + if pki_dict: + conf_dict['pki'] = pki_dict + # save optional args for a call to get_config_defaults setattr(conf_dict, '_dict_kwargs', kwargs) |