mirror of
https://github.com/kubereboot/kured.git
synced 2026-05-09 09:56:47 +00:00
* feat: sentinel-command without nsenter by default Signed-off-by: Christian Kotzbauer <git@ckotzbauer.de> * fix: no readonly mount Signed-off-by: Christian Kotzbauer <git@ckotzbauer.de> * fix: mount at different folder Signed-off-by: Christian Kotzbauer <git@ckotzbauer.de> * feat: add signal-reboot Signed-off-by: Christian Kotzbauer <git@ckotzbauer.de> * feat: make signal configurable and add tests Signed-off-by: Christian Kotzbauer <git@ckotzbauer.de> * build: rename job Signed-off-by: Christian Kotzbauer <git@ckotzbauer.de> * cleanup: linter Signed-off-by: Christian Kotzbauer <git@ckotzbauer.de> * build: also adjust signal manifest Signed-off-by: Christian Kotzbauer <git@ckotzbauer.de> * test: add e2e-tests Signed-off-by: Christian Kotzbauer <git@ckotzbauer.de> * fix: small code restructure Signed-off-by: Christian Kotzbauer <git@ckotzbauer.de> * fix: adjust version-range Signed-off-by: Christian Kotzbauer <git@ckotzbauer.de> --------- Signed-off-by: Christian Kotzbauer <git@ckotzbauer.de>
26 lines
815 B
Go
26 lines
815 B
Go
package reboot
|
|
|
|
import (
|
|
"github.com/kubereboot/kured/pkg/util"
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
// CommandRebootMethod holds context-information for a command reboot.
|
|
type CommandRebootMethod struct {
|
|
nodeID string
|
|
rebootCommand []string
|
|
}
|
|
|
|
// NewCommandReboot creates a new command-rebooter which needs full privileges on the host.
|
|
func NewCommandReboot(nodeID string, rebootCommand []string) *CommandRebootMethod {
|
|
return &CommandRebootMethod{nodeID: nodeID, rebootCommand: rebootCommand}
|
|
}
|
|
|
|
// Reboot triggers the command-reboot.
|
|
func (c *CommandRebootMethod) Reboot() {
|
|
log.Infof("Running command: %s for node: %s", c.rebootCommand, c.nodeID)
|
|
if err := util.NewCommand(c.rebootCommand[0], c.rebootCommand[1:]...).Run(); err != nil {
|
|
log.Fatalf("Error invoking reboot command: %v", err)
|
|
}
|
|
}
|