From c449cb736b24b268b965da5e2932f18bd4fb7785 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Mon, 13 Feb 2023 16:20:07 +0400 Subject: [PATCH] fix: talosctl reboot command passing mode in wait mode The reboot mode was not passed correctly in wait mode. Signed-off-by: Andrey Smirnov --- cmd/talosctl/cmd/talos/reboot.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/cmd/talosctl/cmd/talos/reboot.go b/cmd/talosctl/cmd/talos/reboot.go index 4ed0fd0f9..d38c2112c 100644 --- a/cmd/talosctl/cmd/talos/reboot.go +++ b/cmd/talosctl/cmd/talos/reboot.go @@ -67,7 +67,7 @@ var rebootCmd = &cobra.Command{ return action.NewTracker( &GlobalArgs, action.MachineReadyEventFn, - rebootGetActorID, + rebootGetActorID(opts...), action.WithPostCheck(postCheckFn), action.WithDebug(rebootCmdFlags.debug), action.WithTimeout(rebootCmdFlags.timeout), @@ -75,17 +75,19 @@ var rebootCmd = &cobra.Command{ }, } -func rebootGetActorID(ctx context.Context, c *client.Client) (string, error) { - resp, err := c.RebootWithResponse(ctx) - if err != nil { - return "", err - } +func rebootGetActorID(opts ...client.RebootMode) func(ctx context.Context, c *client.Client) (string, error) { + return func(ctx context.Context, c *client.Client) (string, error) { + resp, err := c.RebootWithResponse(ctx, opts...) + if err != nil { + return "", err + } - if len(resp.GetMessages()) == 0 { - return "", fmt.Errorf("no messages returned from action run") - } + if len(resp.GetMessages()) == 0 { + return "", fmt.Errorf("no messages returned from action run") + } - return resp.GetMessages()[0].GetActorId(), nil + return resp.GetMessages()[0].GetActorId(), nil + } } func init() {