fix: use reboot delay only in case of error

Delay the reboot for 10 seconds only if Talos hits an error, but
otherwise just proceed with the requested action.

This removes 10 seconds on "regular" reboot without kexec.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
This commit is contained in:
Andrey Smirnov 2024-04-26 18:46:00 +04:00
parent 05fd042bb3
commit 98906ed6ea
No known key found for this signature in database
GPG Key ID: FE042E3D4085A811

View File

@ -118,12 +118,12 @@ func handle(ctx context.Context, err error) {
rebootCmd = 0
}
}
}
if rebootCmd == unix.LINUX_REBOOT_CMD_RESTART {
for i := 10; i >= 0; i-- {
log.Printf("rebooting in %d seconds\n", i)
time.Sleep(1 * time.Second)
if rebootCmd == unix.LINUX_REBOOT_CMD_RESTART {
for i := 10; i >= 0; i-- {
log.Printf("rebooting in %d seconds\n", i)
time.Sleep(1 * time.Second)
}
}
}