diff options
| author | John Estabrook <jestabro@vyos.io> | 2025-12-08 19:37:10 -0600 |
|---|---|---|
| committer | John Estabrook <jestabro@vyos.io> | 2025-12-17 21:13:45 -0600 |
| commit | 9e1a4ca21e034233d6fc6299bb181f4e1634820e (patch) | |
| tree | 8f0ce354f1b7eee811da4a156fe19d60ec82b024 /src | |
| parent | e87f921a3611c8054c0253dc78bfbc3f50ca6e28 (diff) | |
| download | vyos1x-config-9e1a4ca21e034233d6fc6299bb181f4e1634820e.tar.gz vyos1x-config-9e1a4ca21e034233d6fc6299bb181f4e1634820e.zip | |
T8061: add boolean test for compatibility of path with reference tree
Diffstat (limited to 'src')
| -rw-r--r-- | src/reference_tree.ml | 9 | ||||
| -rw-r--r-- | src/reference_tree.mli | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/reference_tree.ml b/src/reference_tree.ml index a465a84..e3b5019 100644 --- a/src/reference_tree.ml +++ b/src/reference_tree.ml @@ -687,6 +687,15 @@ let potential_leaf_value rtree cpath = | [] -> false | _ -> is_leaf rtree ref_drop_last +let reference_path_exists rtree cpath = + if Util.is_empty cpath then false + else + if potential_leaf_value rtree cpath then true + else + let rpath = refpath rtree cpath in + if Util.is_empty rpath then false + else true + (* The 'edit' command can descend along a not-as-yet configured path, assuming that it is diff --git a/src/reference_tree.mli b/src/reference_tree.mli index 2bfcb68..e45310e 100644 --- a/src/reference_tree.mli +++ b/src/reference_tree.mli @@ -118,6 +118,8 @@ val set_leaf_data : t -> Config_tree.t -> string list -> Config_tree.t [@@alert exn "Vytree.Empty_path"] [@@alert exn "Vytree.Nonexistent_path"] +val reference_path_exists : t -> string list -> bool + val allowed_edit_level : t -> string list -> (unit, string) result val get_ceil_data : (ref_node_data -> string option) -> t -> string list -> string option |
