From 936e1029ab5332cedbe2304b8a02e9c9a4180a14 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Sat, 9 May 2020 20:28:45 -0500 Subject: config: return empty dict if configuration under path is empty --- python/vyos/config.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'python') 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): -- cgit v1.2.3