提交 40ec0e80 编写于 作者: A Anders F Björklund

Avoid the hard-coded dependency on systemctl

上级 fb6cf6b6
...@@ -20,7 +20,6 @@ import ( ...@@ -20,7 +20,6 @@ import (
"fmt" "fmt"
"net" "net"
"os" "os"
"os/exec"
"path" "path"
"strconv" "strconv"
"time" "time"
...@@ -182,7 +181,10 @@ func (d *Driver) Stop() error { ...@@ -182,7 +181,10 @@ func (d *Driver) Stop() error {
// Restart a host // Restart a host
func (d *Driver) Restart() error { func (d *Driver) Restart() error {
return restartKubelet(d.exec) if err := sysinit.New(d.exec).Restart("kubelet"); err != nil {
return err
}
return nil
} }
// Kill stops a host forcefully, including any containers that we are managing. // Kill stops a host forcefully, including any containers that we are managing.
...@@ -232,13 +234,3 @@ func copySSHKey(src, dst string) error { ...@@ -232,13 +234,3 @@ func copySSHKey(src, dst string) error {
return nil return nil
} }
// restartKubelet restarts the kubelet
func restartKubelet(cr command.Runner) error {
klog.Infof("restarting kubelet.service ...")
c := exec.Command("sudo", "systemctl", "restart", "kubelet.service")
if _, err := cr.RunCmd(c); err != nil {
return err
}
return nil
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册