From 1a1094c28e32c3d6d072cf14a38aa631d51b8aee Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Mon, 18 Apr 2022 19:24:52 +0200 Subject: 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. --- python/vyos/configdict.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'python/vyos/configdict.py') 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 -- cgit v1.2.3