diff options
author | John Estabrook <jestabro@vyos.io> | 2025-04-04 22:48:30 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2025-04-11 13:32:31 -0500 |
commit | ad2d932768734b492a54c728b459437056460668 (patch) | |
tree | e935ec8ec33af3aa64c2bd1a134526533cc026ee /src/session.ml | |
parent | 8ac435cac62f20a9c8bfa2d1671332843af66c33 (diff) | |
download | vyconf-ad2d932768734b492a54c728b459437056460668.tar.gz vyconf-ad2d932768734b492a54c728b459437056460668.zip |
T7321: add save config operation
Diffstat (limited to 'src/session.ml')
-rw-r--r-- | src/session.ml | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/session.ml b/src/session.ml index 1843682..5f0d5a3 100644 --- a/src/session.ml +++ b/src/session.ml @@ -114,6 +114,13 @@ let load w s file = | Ok config -> validate_tree w config; {s with proposed_config=config;} +let save w s file = + let ct = w.running_config in + let res = Vyos1x.Config_file.save_config ct file in + match res with + | Error e -> raise (Session_error (Printf.sprintf "Error saving config: %s" e)) + | Ok () -> s + let get_value w s path = if not (VT.exists s.proposed_config path) then raise (Session_error ("Config path does not exist")) |