summaryrefslogtreecommitdiff
path: root/src/vycall_client.ml
diff options
context:
space:
mode:
Diffstat (limited to 'src/vycall_client.ml')
-rw-r--r--src/vycall_client.ml47
1 files changed, 8 insertions, 39 deletions
diff --git a/src/vycall_client.ml b/src/vycall_client.ml
index c7fc811..11bbe3f 100644
--- a/src/vycall_client.ml
+++ b/src/vycall_client.ml
@@ -1,12 +1,10 @@
(* send commit data to Python commit daemon *)
open Vycall_message.Vycall_pbt
-open Vyconfd_config.Commit
+open Commit
module CT = Vyos1x.Config_tree
module IC = Vyos1x.Internal.Make(CT)
-module ST = Vyconfd_config.Startup
-module DF = Vyconfd_config.Defaults
module FP = FilePath
type t = {
@@ -33,8 +31,6 @@ let call_to_node_data ((c: call), (nd: node_data)) =
let commit_data_to_commit_proto cd =
{ session_id = cd.session_id;
- named_active = cd.named_active;
- named_proposed = cd.named_proposed;
dry_run = cd.dry_run;
atomic = cd.atomic;
background = cd.background;
@@ -88,37 +84,10 @@ let create sockfile =
let oc = Lwt_io.of_fd ~mode:Lwt_io.Output sock in
Lwt.return { ic=ic; oc=oc; }
-let update session_data =
- Lwt.return (commit_store session_data)
-
-let do_commit session_data =
- let session = commit_data_to_commit_proto session_data in
- let run () =
- let sockfile = "/run/vyos-commitd.sock" in
- let%lwt client = create sockfile in
- let%lwt resp = do_call client session in
- let%lwt () = Lwt_io.close client.oc in
- update (commit_proto_to_commit_data resp session_data)
- in Lwt_main.run @@ run ()
-
-(* test function *)
-let test_commit at wt =
- let vc =
- ST.load_daemon_config DF.defaults.config_file in
- let () =
- IC.write_internal at (FP.concat vc.session_dir vc.running_cache) in
- let () =
- IC.write_internal wt (FP.concat vc.session_dir vc.session_cache) in
- let rt_opt =
- ST.read_reference_tree (FP.concat vc.reftree_dir vc.reference_tree)
- in
- match rt_opt with
- | Error msg -> print_endline msg
- | Ok rt ->
- let del_list, add_list =
- calculate_priority_lists rt at wt
- in
- let commit_session =
- { default_commit_data with node_list = del_list @ add_list }
- in
- do_commit commit_session
+let do_commit commit_data =
+ let session = commit_data_to_commit_proto commit_data in
+ let sockfile = "/run/vyos-commitd.sock" in
+ let%lwt client = create sockfile in
+ let%lwt resp = do_call client session in
+ let%lwt () = Lwt_io.close client.oc in
+ Lwt.return(commit_proto_to_commit_data resp commit_data)