diff options
| author | John Estabrook <jestabro@vyos.io> | 2025-08-04 14:54:23 -0500 |
|---|---|---|
| committer | John Estabrook <jestabro@vyos.io> | 2025-08-04 19:58:30 -0500 |
| commit | 80ce51be1e6bc2365d6e7ae5c8d3ae6b809e67a0 (patch) | |
| tree | 75081939ac37588fbdba4da23c2bc7641e70f64c /src/session.ml | |
| parent | 70c02069fc1199edcc74cfdb7cb59192369bdef8 (diff) | |
| download | vyconf-80ce51be1e6bc2365d6e7ae5c8d3ae6b809e67a0.tar.gz vyconf-80ce51be1e6bc2365d6e7ae5c8d3ae6b809e67a0.zip | |
T7688: remove tag node path on deletion of last tag node value
Diffstat (limited to 'src/session.ml')
| -rw-r--r-- | src/session.ml | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/session.ml b/src/session.ml index 62037d5..5cd5027 100644 --- a/src/session.ml +++ b/src/session.ml @@ -110,10 +110,25 @@ let set w s path = in {s with proposed_config=config; changeset=(op :: s.changeset)} +let prune_del_path node path = + if CT.is_tag_value node path then + let tag_path = Vyos1x.Util.drop_last path in + let terminal = VT.is_terminal_path node tag_path in + match terminal with + | true -> CT.delete node tag_path None + | false -> node + else node + let delete w s path = let path, value = split_path w s path in let op = CfgDelete (path, value) in - let config = apply_cfg_op op s.proposed_config in + let config = + try + apply_cfg_op op s.proposed_config |> + (fun c -> prune_del_path c path) + with + | VT.Nonexistent_path | CT.No_such_value -> s.proposed_config + in {s with proposed_config=config; changeset=(op :: s.changeset)} let discard w s = |
