From 59ebae9198439ddd1e9bbdec61d163f638e1071a Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Tue, 24 Jun 2025 07:07:09 -0500 Subject: 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. --- src/session.ml | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/session.ml') 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 -- cgit v1.2.3