diff options
| author | Daniil Baturin <daniil@baturin.org> | 2024-11-07 18:02:08 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-07 18:02:08 +0000 |
| commit | 196fdd7fdf6dcf751b7364c59e34278bfd0193e3 (patch) | |
| tree | cfeff0991481c8281e24cf1698b20a76854059a4 /src/adapter/vy_delete.ml | |
| parent | dd9271b4304c6b1a5a2576821d1b2b8fd3aa6bf5 (diff) | |
| parent | 9b90d3cc4da72c13ef4270150e4b547ff03fc813 (diff) | |
| download | vyconf-196fdd7fdf6dcf751b7364c59e34278bfd0193e3.tar.gz vyconf-196fdd7fdf6dcf751b7364c59e34278bfd0193e3.zip | |
Merge pull request #11 from jestabro/vyconf-minimal
T6718: use the vyconf daemon for validation of set commands
Diffstat (limited to 'src/adapter/vy_delete.ml')
| -rw-r--r-- | src/adapter/vy_delete.ml | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/adapter/vy_delete.ml b/src/adapter/vy_delete.ml new file mode 100644 index 0000000..304e74b --- /dev/null +++ b/src/adapter/vy_delete.ml @@ -0,0 +1,30 @@ +let () = + let path_list = Array.to_list (Array.sub Sys.argv 1 (Array.length Sys.argv - 1)) + in + let () = + if List.length path_list = 0 then + (Printf.printf "no path specified\n"; exit 1) + in + let handle = + let h = Vyos1x_adapter.cstore_handle_init () in + if not (Vyos1x_adapter.cstore_in_config_session_handle h) then + (Vyos1x_adapter.cstore_handle_free h; + Printf.printf "not in config session\n"; exit 1) + else Some h + in + let output = + match handle with + | Some h -> Vyos1x_adapter.cstore_delete_path h path_list + | None -> "missing session handle" + in + let ret = + if output = "" then 0 + else 1 + in + let () = + match handle with + | Some h -> Vyos1x_adapter.cstore_handle_free h + | None -> () + in + let () = print_endline output in + exit ret |
