summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2020-05-09 20:28:45 -0500
committerJohn Estabrook <jestabro@vyos.io>2020-05-17 14:04:55 -0500
commit936e1029ab5332cedbe2304b8a02e9c9a4180a14 (patch)
tree5e715e2cb2d38c091b725a5753af99aa13eb335d /python
parentdd6d46f7a60fcc196172e8a7278d7f91e9a63dda (diff)
downloadvyos-1x-936e1029ab5332cedbe2304b8a02e9c9a4180a14.tar.gz
vyos-1x-936e1029ab5332cedbe2304b8a02e9c9a4180a14.zip
config: return empty dict if configuration under path is empty
Diffstat (limited to 'python')
-rw-r--r--python/vyos/config.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/python/vyos/config.py b/python/vyos/config.py
index 0bc6be12a..e992163a2 100644
--- a/python/vyos/config.py
+++ b/python/vyos/config.py
@@ -278,8 +278,12 @@ class Config(object):
Returns: a dict representation of the config
"""
res = self.show_config(self._make_path(path), effective=effective)
- config_tree = vyos.configtree.ConfigTree(res)
- config_dict = json.loads(config_tree.to_json())
+ if res:
+ config_tree = vyos.configtree.ConfigTree(res)
+ config_dict = json.loads(config_tree.to_json())
+ else:
+ config_dict = {}
+
return config_dict
def is_multi(self, path):