summaryrefslogtreecommitdiff
path: root/src/vytree.ml
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2024-03-20 21:33:02 -0500
committerJohn Estabrook <jestabro@vyos.io>2024-03-21 08:15:51 -0500
commit7f7df88bbd4f58845ac272eb855e259eb82505d6 (patch)
tree35928d4eda944bfcfbee04695af09fb35799afb7 /src/vytree.ml
parent84720462dc1d77c7a5fbdf10e9c7db739aef1ce9 (diff)
downloadvyos1x-config-7f7df88bbd4f58845ac272eb855e259eb82505d6.tar.gz
vyos1x-config-7f7df88bbd4f58845ac272eb855e259eb82505d6.zip
T6149: update node_data if necessary when merging nodes
Diffstat (limited to 'src/vytree.ml')
-rw-r--r--src/vytree.ml4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vytree.ml b/src/vytree.ml
index ace587b..05b3088 100644
--- a/src/vytree.ml
+++ b/src/vytree.ml
@@ -167,6 +167,10 @@ let update node path data =
replace node' child
in do_with_child (update_data data) node path
+let insert_or_update ?(position=Default) node path data =
+ try insert ~position:position node path data
+ with Duplicate_child -> update node path data
+
let rec get node path =
match path with
| [] -> raise Empty_path