Skip to content

Commit

Permalink
CA-399187: Allow gencert to be called without groupid (#5987)
Browse files Browse the repository at this point in the history
Last year, an argument to determine the group id of the certificates
created
was added. This broke test clients, and there's no need no make it
compulsory
since there's a default value: -1.

Modify the binary so it can accept only 3 arguments like before, and
change the
help output to mention the group id.

This makes quite a few internal certificate tests to pass compare the
previous suite run 204647 to the new 204840
  • Loading branch information
psafont authored Sep 16, 2024
2 parents f20d127 + 8c30988 commit 85f9271
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
33 changes: 24 additions & 9 deletions ocaml/gencert/gencert.ml
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,34 @@ let () =
let program_name = Sys.argv.(0) in
let dbg = Printf.sprintf "%s - %f" program_name (Unix.gettimeofday ()) in
(* if necessary use Unix.localtime to debug *)
D.debug "%s" dbg ;
match Sys.argv with
| [|_; path; _; _|] when Sys.file_exists path ->
D.info "file already exists at path (%s) - doing nothing" path ;
exit 0
| [|_; path; cert_gid; sni|] -> (
let sni_or_exit sni =
match SNI.of_string sni with
| Some sni ->
main ~dbg ~path ~cert_gid:(int_of_string cert_gid) ~sni ()
sni
| None ->
D.error "SNI must be default or xapi:pool, but got '%s'" sni ;
exit 1
)
in
let gid_or_exit gid =
match int_of_string_opt gid with
| Some gid ->
gid
| None ->
D.error "GROUPID must be an integer, but got '%s'" gid ;
exit 1
in
D.debug "%s" dbg ;
match Sys.argv with
| ([|_; path; _|] | [|_; path; _; _|]) when Sys.file_exists path ->
D.info "file already exists at path (%s) - doing nothing" path ;
exit 0
| [|_; path; sni|] ->
let sni = sni_or_exit sni in
main ~dbg ~path ~cert_gid:(-1) ~sni ()
| [|_; path; cert_gid; sni|] ->
let sni = sni_or_exit sni in
let cert_gid = gid_or_exit cert_gid in
main ~dbg ~path ~cert_gid ~sni ()
| _ ->
D.error "Usage: %s PATH (default|xapi:pool)" program_name ;
D.error "Usage: %s PATH [GROUPID] (default|xapi:pool)" program_name ;
exit 1
2 changes: 1 addition & 1 deletion ocaml/idl/datamodel_lifecycle.ml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ let prototyped_of_field = function
| "host", "last_software_update" ->
Some "22.20.0"
| "VM_guest_metrics", "netbios_name" ->
Some "24.27.0-next"
Some "24.28.0"
| "VM", "groups" ->
Some "24.19.1"
| "VM", "pending_guidances_full" ->
Expand Down

0 comments on commit 85f9271

Please sign in to comment.