summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2021-08-13 08:57:37 -0500
committerJohn Estabrook <jestabro@vyos.io>2021-08-13 11:30:59 -0500
commite5c61fc80119556bb1b61a80868d4a3470e07319 (patch)
treebb3539d0128ccb5d667af7d81fd9ab97d1686fb0
parent326cab3da592ee5255ed1f66025a91ac6892d429 (diff)
downloadvyos-1x-e5c61fc80119556bb1b61a80868d4a3470e07319.tar.gz
vyos-1x-e5c61fc80119556bb1b61a80868d4a3470e07319.zip
xml: T3234: update instead of overwrite on repeated path
-rw-r--r--python/vyos/xml/load.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/python/vyos/xml/load.py b/python/vyos/xml/load.py
index 37479c6e1..0578bef80 100644
--- a/python/vyos/xml/load.py
+++ b/python/vyos/xml/load.py
@@ -125,14 +125,20 @@ def _format_nodes(inside, conf, xml):
for node in nodes:
name = node.pop('@name')
into = inside + [name]
- r[name] = _format_node(into, node, xml)
+ if name in r:
+ r[name].update(_format_node(into, node, xml))
+ else:
+ r[name] = _format_node(into, node, xml)
r[name][kw.node] = nodename
xml[kw.tags].append(' '.join(into))
else:
node = nodes
name = node.pop('@name')
into = inside + [name]
- r[name] = _format_node(inside + [name], node, xml)
+ if name in r:
+ r[name].update(_format_node(inside + [name], node, xml))
+ else:
+ r[name] = _format_node(inside + [name], node, xml)
r[name][kw.node] = nodename
xml[kw.tags].append(' '.join(into))
return r