From 4b06cac36c8ca4d63926871885e8ac52a5a899f1 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Wed, 3 Jan 2024 17:21:13 +0100 Subject: configdict: T5837: node_changed() shall not return duplicate list items This extends commit 4ee406470 ("configdict: T5837: add support to return added nodes when calling node_changed()") so no duplicate list elements get returned. (cherry picked from commit 301312b293238d3041c8912af6fdb86b506d7ab4) --- python/vyos/configdict.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'python') diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py index 6a421485f..089d9d3d5 100644 --- a/python/vyos/configdict.py +++ b/python/vyos/configdict.py @@ -163,6 +163,9 @@ def node_changed(conf, path, key_mangling=None, recursive=False, expand_nodes=No output.extend(list(tmp['delete'].keys())) if expand_nodes & Diff.ADD: output.extend(list(tmp['add'].keys())) + + # remove duplicate keys from list, this happens when a node (e.g. description) is altered + output = list(dict.fromkeys(output)) return output def get_removed_vlans(conf, path, dict): -- cgit v1.2.3