Skip to content

Commit

Permalink
Rebase me: use is_infix directly
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Reis <benjamin.reis@vates.tech>
  • Loading branch information
benjamreis committed May 14, 2024
1 parent 978b260 commit 1c111b0
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions ocaml/xapi/xapi_vm.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1651,13 +1651,20 @@ let get_secureboot_readiness ~__context ~self =
Helpers.call_script !Xapi_globs.varstore_ls
[Db.VM.get_uuid ~__context ~self]
in
let contains str substr =
Astring.String.is_infix ~affix:substr str
let ls_lines = String.split_on_char '\n' varstore_ls in
let ls_keys =
List.map
(fun elem ->
(* Lines follow this pattern: <GUID> <KEY>*)
let splitted = String.split_on_char ' ' elem in
List.nth splitted 1
)
ls_lines
in
let pk_present = contains varstore_ls "PK" in
let kek_present = contains varstore_ls "KEK" in
let db_present = contains varstore_ls "db" in
let dbx_present = contains varstore_ls "dbx" in
let pk_present = List.mem "PK" ls_keys in
let kek_present = List.mem "KEK" ls_keys in
let db_present = List.mem "db" ls_keys in
let dbx_present = List.mem "dbx" ls_keys in
match (pk_present, kek_present, db_present, dbx_present) with
| true, true, true, true ->
`ready
Expand Down

0 comments on commit 1c111b0

Please sign in to comment.