diff options
author | John Estabrook <jestabro@vyos.io> | 2025-04-05 23:09:49 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2025-04-11 13:32:31 -0500 |
commit | aa6b3e603b3ee8e70b5a2e5625711b5da082d076 (patch) | |
tree | 9cc9d942a20cc606217811c0d1de213ebec96587 /src | |
parent | bb2f63246b2861d3a3c7b0ed713b256690fd3a38 (diff) | |
download | vyconf-aa6b3e603b3ee8e70b5a2e5625711b5da082d076.tar.gz vyconf-aa6b3e603b3ee8e70b5a2e5625711b5da082d076.zip |
T7321: add validate_tree for use by load config
Diffstat (limited to 'src')
-rw-r--r-- | src/session.ml | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/session.ml b/src/session.ml index 602ab14..8aeffb3 100644 --- a/src/session.ml +++ b/src/session.ml @@ -69,6 +69,21 @@ let validate w _s path = RT.validate_path D.(w.dirs.validators) w.reference_tree path with RT.Validation_error x -> raise (Session_error x) +let validate_tree w' t = + let validate_path w out path = + let res = + try + RT.validate_path D.(w.dirs.validators) w.reference_tree path; + out + with RT.Validation_error x -> out ^ x + in res + in + let paths = CT.value_paths_of_tree t in + let out = List.fold_left (validate_path w') "" paths in + match out with + | "" -> () + | _ -> raise (Session_error out) + let split_path w _s path = RT.split_path w.reference_tree path |