Skip to content

Commit 7c4b7a8

Browse files
committed
Do not fail when fullpath is given to extract certificates
Signed-off-by: BenjiReis <benjamin.reis@vates.fr>
1 parent b2711aa commit 7c4b7a8

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

ocaml/xapi/xapi_host.ml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2672,12 +2672,17 @@ let allocate_resources_for_vm ~__context ~self:_ ~vm:_ ~live:_ =
26722672
(* Implemented entirely in Message_forwarding *)
26732673
()
26742674

2675+
let ( // ) = Filename.concat
2676+
26752677
(* Sync uefi certificates with the ones of the hosts *)
2676-
let extract_certificate_file name =
2677-
if String.contains name '/' then
2678-
(* Internal error: tarfile not created correctly *)
2679-
failwith ("Path in certificate tarball %s contains '/'" ^ name) ;
2680-
let path = Filename.concat !Xapi_globs.varstore_dir name in
2678+
let extract_certificate_file tarpath =
2679+
let filename =
2680+
if String.contains tarpath '/' then
2681+
Filename.basename tarpath
2682+
else
2683+
tarpath
2684+
in
2685+
let path = !Xapi_globs.varstore_dir // filename in
26812686
Helpers.touch_file path ; path
26822687

26832688
let with_temp_file_contents ~contents f =
@@ -2693,8 +2698,6 @@ let with_temp_file_contents ~contents f =
26932698

26942699
let ( let@ ) f x = f x
26952700

2696-
let ( // ) = Filename.concat
2697-
26982701
let really_read_uefi_certificates_from_disk ~__context ~host:_ from_path =
26992702
let certs_files = Sys.readdir from_path |> Array.map (( // ) from_path) in
27002703
let@ temp_file, with_temp_out_ch =

0 commit comments

Comments
 (0)