From 59bb297a37ae1cc42581fa078ef274ace20665a3 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Thu, 2 Jul 2020 13:58:36 -0500 Subject: config_dict: T2670: remove dependency on show_config --- python/vyos/config.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'python/vyos/config.py') diff --git a/python/vyos/config.py b/python/vyos/config.py index 6ad45819a..1aa8082dc 100644 --- a/python/vyos/config.py +++ b/python/vyos/config.py @@ -292,14 +292,16 @@ class Config(object): Args: path (str list): Configuration tree path, can be empty Returns: a dict representation of the config """ - res = self.show_config(effective=effective) config_dict = {} - if not res: - return config_dict + + if effective: + if self._running_config: + config_dict = json.loads((self._running_config).to_json()) else: - config_tree = vyos.configtree.ConfigTree(res) - config_dict = json.loads(config_tree.to_json()) - config_dict = vyos.util.get_sub_dict(config_dict, self._make_path(path), get_first_key) + if self._session_config: + config_dict = json.loads((self._session_config).to_json()) + + config_dict = vyos.util.get_sub_dict(config_dict, self._make_path(path), get_first_key) if key_mangling: if not (isinstance(key_mangling, tuple) and \ -- cgit v1.2.3