summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2020-07-02 13:58:36 -0500
committerJohn Estabrook <jestabro@vyos.io>2020-07-03 07:04:46 -0500
commit59bb297a37ae1cc42581fa078ef274ace20665a3 (patch)
tree7edfb02b32309c47252fa75000d3712f2dbfd393
parent5ceec317f24ed39db4cf8921e8078ab119059df9 (diff)
downloadvyos-1x-59bb297a37ae1cc42581fa078ef274ace20665a3.tar.gz
vyos-1x-59bb297a37ae1cc42581fa078ef274ace20665a3.zip
config_dict: T2670: remove dependency on show_config
-rw-r--r--python/vyos/config.py14
1 files changed, 8 insertions, 6 deletions
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 \