From bbcbdf0e8620323fdfce9707cd97a4b756a5baf3 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Thu, 18 Dec 2025 20:40:10 -0600 Subject: T8091: sanitize path of leaf values for show command In the context of fixing output on leaf nodes, drop last path component if leaf value is included (as it is not prohibited). --- src/session.ml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/session.ml b/src/session.ml index 0bd3d95..00d47c0 100644 --- a/src/session.ml +++ b/src/session.ml @@ -590,15 +590,20 @@ let exists w s path = let show_config w s path = let path_total = s.edit_level @ path in + let path_show = + match RT.get_path_type w.reference_tree path_total with + | `Leaf_value -> Vyos1x.Util.drop_last path_total + | _ -> path_total + in let proposed_config = get_proposed_config w s in - if not (Vyos1x.Util.is_empty path_total) && - not ((VT.exists[@alert "-exn"]) proposed_config path_total) + if not (Vyos1x.Util.is_empty path_show) && + not ((VT.exists[@alert "-exn"]) proposed_config path_show) then raise (Session_error "Path does not exist") else let res = (CD.diff_show[@alert "-exn"]) w.reference_tree - path_total + path_show w.running_config proposed_config in res -- cgit v1.2.3