From 11c222da5912b1137259ec43fc1b187f3585dd25 Mon Sep 17 00:00:00 2001 From: Pau Ruiz Safont Date: Thu, 12 Sep 2024 15:13:16 +0100 Subject: [PATCH 1/2] datamodel_lifecycle: bump to latest version Signed-off-by: Pau Ruiz Safont --- ocaml/idl/datamodel_lifecycle.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocaml/idl/datamodel_lifecycle.ml b/ocaml/idl/datamodel_lifecycle.ml index fd2dee68944..bcd67b50acb 100644 --- a/ocaml/idl/datamodel_lifecycle.ml +++ b/ocaml/idl/datamodel_lifecycle.ml @@ -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" -> From 8c30988cf189af21d73cc3f284028861d3ed8d4b Mon Sep 17 00:00:00 2001 From: Pau Ruiz Safont Date: Thu, 12 Sep 2024 15:06:01 +0100 Subject: [PATCH 2/2] CA-399187: Allow gencert to be called without groupid 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. Signed-off-by: Pau Ruiz Safont --- ocaml/gencert/gencert.ml | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/ocaml/gencert/gencert.ml b/ocaml/gencert/gencert.ml index 695002ebb67..0d3284379ff 100644 --- a/ocaml/gencert/gencert.ml +++ b/ocaml/gencert/gencert.ml @@ -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