diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-04-18 19:24:52 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2022-04-18 19:24:52 +0200 |
commit | 1a1094c28e32c3d6d072cf14a38aa631d51b8aee (patch) | |
tree | fd652d63f5d5ee0d7dedb087e6255c8b224eb699 /python/vyos | |
parent | c8da5866a79189244549d20837089924f0355e6e (diff) | |
download | vyos-1x-1a1094c28e32c3d6d072cf14a38aa631d51b8aee.tar.gz vyos-1x-1a1094c28e32c3d6d072cf14a38aa631d51b8aee.zip |
vyos.configdict(): T4369: bugfix - execution order in leaf_node_changed()
Commit c685c0f7 ("vyos.configdict(): T4369: leaf_node_changed() must return True
when node is added") added a code path then a node was newly added to the CLI.
Unfortunately it turned out that this introduced a regression:
File "/usr/lib/python3/dist-packages/vyos/ifconfig/wireguard.py", line 230, in update
super().update(config)
File "/usr/lib/python3/dist-packages/vyos/ifconfig/interface.py", line 1428, in update
for addr in list_diff(config['address_old'], new_addr):
File "/usr/lib/python3/dist-packages/vyos/configdict.py", line 105, in list_diff
return [item for item in first if item not in second]
TypeError: 'bool' object is not iterable
The execution order of the if statements is essential and the new check was
moved to the bottom to not interfere with the existing logic.
Diffstat (limited to 'python/vyos')
-rw-r--r-- | python/vyos/configdict.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py index ddb9b563d..f50db0c99 100644 --- a/python/vyos/configdict.py +++ b/python/vyos/configdict.py @@ -123,9 +123,6 @@ def leaf_node_changed(conf, path): if old is None and isinstance(new, dict): # valueLess nodes return {} if node was added return True - if old is None and new is not None: - # node was added to the CLI, e.g. OpenVPN node "openvpn-options" - return True if old is None: return [] if isinstance(old, str): @@ -136,6 +133,9 @@ def leaf_node_changed(conf, path): elif isinstance(new, type(None)): new = [] return list_diff(old, new) + if old is None and new is not None: + # node was added to the CLI + return True return None |