diff options
author | John Estabrook <jestabro@vyos.io> | 2025-04-04 20:00:39 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2025-04-11 13:32:31 -0500 |
commit | 8ac435cac62f20a9c8bfa2d1671332843af66c33 (patch) | |
tree | c6e020d7319781e183b13384ded6b1e3417a21fb /src/session.ml | |
parent | aa6b3e603b3ee8e70b5a2e5625711b5da082d076 (diff) | |
download | vyconf-8ac435cac62f20a9c8bfa2d1671332843af66c33.tar.gz vyconf-8ac435cac62f20a9c8bfa2d1671332843af66c33.zip |
T7321: add load config operation: load to proposed config
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 8aeffb3..1843682 100644 --- a/src/session.ml +++ b/src/session.ml @@ -107,6 +107,13 @@ let delete w s path = let config = apply_cfg_op op s.proposed_config in {s with proposed_config=config; changeset=(op :: s.changeset)} +let load w s file = + 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 -> + validate_tree w config; {s with proposed_config=config;} + let get_value w s path = if not (VT.exists s.proposed_config path) then raise (Session_error ("Config path does not exist")) |