diff options
| author | John Estabrook <jestabro@vyos.io> | 2025-06-24 07:07:09 -0500 |
|---|---|---|
| committer | John Estabrook <jestabro@vyos.io> | 2025-07-06 18:27:40 -0500 |
| commit | 59ebae9198439ddd1e9bbdec61d163f638e1071a (patch) | |
| tree | 119133764b05a6cd1a5a182c555044b2170f4a17 /src/session.ml | |
| parent | 1e4f661b8c29edf0b03eac4adf032735d6a885a7 (diff) | |
| download | vyconf-59ebae9198439ddd1e9bbdec61d163f638e1071a.tar.gz vyconf-59ebae9198439ddd1e9bbdec61d163f638e1071a.zip | |
T7499: use direct request to vyconfd to avoid re-validating paths
Merging before passing to the backend results in re-validation of
existing paths in the proposed config; this is unavoidable with the
legacy backend. For vyconf, send the merge proposal with the request, so
validation is only required on new paths.
Diffstat (limited to 'src/session.ml')
| -rw-r--r-- | src/session.ml | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/session.ml b/src/session.ml index 72e766d..5e276c2 100644 --- a/src/session.ml +++ b/src/session.ml @@ -142,6 +142,16 @@ let load w s file cached = | Ok config -> validate_tree w config; {s with proposed_config=config;} +let merge w s file destructive = + let ct = Vyos1x.Config_file.load_config file in + match ct with + | Error e -> raise (Session_error (Printf.sprintf "Error loading config: %s" e)) + | Ok config -> + let () = validate_tree w config in + let merged = CD.tree_merge ~destructive:destructive s.proposed_config config + in + {s with proposed_config=merged;} + let save w s file = let ct = w.running_config in let res = Vyos1x.Config_file.save_config ct file in |
