summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 \