summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-09-09 22:31:18 +0200
committerChristian Breunig <christian@breunig.cc>2026-09-10 17:23:50 +0200
commitaa3f1c548198a1110d67385f19ccc910c5c48be8 (patch)
treeb2c66b97a6166ec7dafde6f63bcb5eaa8647f730 /python
parent395338fe0692b4ecf8547ab5cf18dd147e07902d (diff)
downloadvyos-1x-aa3f1c548198a1110d67385f19ccc910c5c48be8.tar.gz
vyos-1x-aa3f1c548198a1110d67385f19ccc910c5c48be8.zip
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.
Diffstat (limited to 'python')
-rw-r--r--python/vyos/configdict.py7
1 files changed, 6 insertions, 1 deletions
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]