From aa3f1c548198a1110d67385f19ccc910c5c48be8 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Wed, 9 Sep 2026 22:31:18 +0200 Subject: configdict: T9269: no phantom removal when a multi node gains a value A multi node with a single value is a plain string in the JSON rendering of the config tree, and only becomes a list once it holds several values. leaf_node_changed() tested for a string before diffing the lists, so appending a value reported the already configured one as gone. Adding a second bond member thus produced an "interface_remove" entry for the first, and BondIf.update() released it right after enslaving the new one, leaving the bond with the new member only. Normalize to a list and reuse list_diff(). Only the string to list append changes, from [old] to []. interface.py was immune as it re-applies list_diff() to address_old, protocols_static_arp.py was not. --- python/vyos/configdict.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'python') diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py index ff784251a..da2e9792c 100644 --- a/python/vyos/configdict.py +++ b/python/vyos/configdict.py @@ -133,8 +133,13 @@ def leaf_node_changed(conf, path): return True if old is None: return [] + # A multi node holding a single value is a plain string in the JSON + # rendering of the config tree, and only becomes a list once it holds + # several values. Normalize before diffing, else appending a value to a + # single-valued multi node reports the already configured value as gone + # just because its representation changed from string to list if isinstance(old, str): - return [old] + old = [old] if isinstance(old, list): if isinstance(new, str): new = [new] -- cgit v1.2.3