fix: talosctl reboot command passing mode in wait mode

The reboot mode was not passed correctly in wait mode.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
This commit is contained in:
Andrey Smirnov 2023-02-13 16:20:07 +04:00
parent 34ab0007a6
commit c449cb736b
No known key found for this signature in database
GPG Key ID: 7B26396447AB6DFD

View File

@ -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() {