summaryrefslogtreecommitdiff
path: root/python/vyos/configdict.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-08-20 20:12:53 +0200
committerChristian Poessinger <christian@poessinger.com>2021-08-22 09:55:53 +0200
commit281274de1e20e1f937e92960bfd72d3d608e75f3 (patch)
tree34861a3231041a6d794cdcaf3357d1d932c48c74 /python/vyos/configdict.py
parente6666353c41de8ad675d4157cdbe848a42ba6385 (diff)
downloadvyos-1x-281274de1e20e1f937e92960bfd72d3d608e75f3.tar.gz
vyos-1x-281274de1e20e1f937e92960bfd72d3d608e75f3.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']) >>> [''] (cherry picked from commit f476e456e20393e7e7e91b73e369c9b033fbf048)
Diffstat (limited to 'python/vyos/configdict.py')
-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 a1a6c5933..010711478 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)):