Changed a policy in vsys. When an acl is empty, the script doesn't show up in ANY...
[vsys.git] / conffile.ml
index d9fe129..6279d16 100644 (file)
@@ -5,6 +5,15 @@ open Scanf
 let split_conf_line s =
   sscanf s "%s %s" (fun s1 s2->(s1,s2))
 
+let check_dir fe = 
+  let (vsysdir,slice) = fe in
+  let verdict = try Some(Unix.stat vsysdir) with
+      _ -> fprintf logfd "vsys directory not setup for slice %s\n" slice;flush logfd;None
+  in
+    match verdict with 
+      | None->false 
+      | Some(_) -> true
+
 let rec in_list elt lst =
   match lst with 
     | car::cdr ->
@@ -12,6 +21,7 @@ let rec in_list elt lst =
     | [] -> false
 
 let read_frontends f =
+  let setup_ok = if (!Globals.failsafe) then check_dir else fun _ -> true in
   let f_file = try open_in f with e -> fprintf logfd "Could not open config file\n";flush logfd;raise e
   in
   let rec read_conf_file cur_list =
@@ -19,7 +29,7 @@ let read_frontends f =
       match next_line with
         | Some(inp_line) -> 
             let fe = split_conf_line inp_line in
-            let new_list = if (not (in_list fe cur_list)) then (fe::cur_list) else cur_list
+            let new_list = if (not (in_list fe cur_list) && (setup_ok(fe))) then (fe::cur_list) else cur_list
             in
             read_conf_file new_list
         | None -> cur_list