summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-08-20 20:12:53 +0200
committerChristian Poessinger <christian@poessinger.com>2021-08-21 21:48:58 +0200
commitf476e456e20393e7e7e91b73e369c9b033fbf048 (patch)
treecc4c5e73f06069cdda70b0ff7415c014754fc66f /python
parent64c9fdef02323309e97b2bb682604ada52d651e8 (diff)
downloadvyos-1x-f476e456e20393e7e7e91b73e369c9b033fbf048.tar.gz
vyos-1x-f476e456e20393e7e7e91b73e369c9b033fbf048.zip
vyos.configdict: leaf_node_changed() must return empty dict when node is added
vyos@vyos# show interfaces pppoe pppoe pppoe10 { + access-concentrator asdfg authentication { password bar user foo } default-route force no-peer-dns source-interface eth0.202 } vyos@vyos# python3 Python 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from vyos.config import Config >>> from vyos.configdict import get_interface_dict >>> from vyos.configdict import leaf_node_changed >>> conf = Config() >>> base = ['interfaces', 'pppoe'] >>> tmp = get_interface_dict(conf, base, 'pppoe10') >>> leaf_node_changed(conf, ['access-concentrator']) >>> ['']
Diffstat (limited to 'python')
-rw-r--r--python/vyos/configdict.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py
index a0056a142..e15579b95 100644
--- a/python/vyos/configdict.py
+++ b/python/vyos/configdict.py
@@ -117,9 +117,11 @@ def leaf_node_changed(conf, path):
D.set_level(conf.get_level())
(new, old) = D.get_value_diff(path)
if new != old:
+ if old is None:
+ return ['']
if isinstance(old, str):
return [old]
- elif isinstance(old, list):
+ if isinstance(old, list):
if isinstance(new, str):
new = [new]
elif isinstance(new, type(None)):