Skip to content

Commit 6b37717

Browse files
committed
CA-227142: Print update precheck result in CLI
Signed-off-by: Cheng Zhang <[email protected]>
1 parent 79bc6b3 commit 6b37717

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

ocaml/xapi/cli_operations.ml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4798,15 +4798,20 @@ let update_introduce printer rpc session_id params =
47984798
let uuid = Client.Pool_update.get_uuid ~rpc ~session_id ~self:update in
47994799
printer (Cli_printer.PList [uuid])
48004800

4801+
let livepatch_status_to_string state =
4802+
match state with
4803+
| `ok -> "Ok."
4804+
| `ok_livepatch_complete -> "Ok: Patch can be applied without reboot."
4805+
| `ok_livepatch_incomplete -> "Ok: Patch can be applied, but a reboot will be required."
4806+
48014807
let update_precheck printer rpc session_id params =
48024808
let uuid = List.assoc "uuid" params in
4803-
ignore(
4804-
do_host_op rpc session_id (fun _ host ->
4805-
let host_ref = host.getref () in
4806-
let ref = Client.Pool_update.get_by_uuid rpc session_id uuid in
4807-
Client.Pool_update.precheck rpc session_id ref host_ref
4808-
) params ["uuid"]
4809-
)
4809+
let result = do_host_op rpc session_id (fun _ host ->
4810+
let host_ref = host.getref () in
4811+
let ref = Client.Pool_update.get_by_uuid rpc session_id uuid in
4812+
Client.Pool_update.precheck rpc session_id ref host_ref ) params ["uuid"] in
4813+
let result_msg = List.map livepatch_status_to_string result in
4814+
printer (Cli_printer.PList result_msg)
48104815

48114816
let update_apply printer rpc session_id params =
48124817
let uuid = List.assoc "uuid" params in

0 commit comments

Comments
 (0)