Merge pull request #11667 from ilya-zuyev/fix_docker_stop_log
Do not return an error from Systemd.ForceStop(svc) if svc is already stoppedpull/11720/head
commit
d4fe77356c
|
@ -19,7 +19,9 @@ package sysinit
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"k8s.io/minikube/pkg/minikube/assets"
|
||||
)
|
||||
|
@ -123,7 +125,14 @@ func (s *Systemd) Stop(svc string) error {
|
|||
|
||||
// ForceStop terminates a service with prejudice
|
||||
func (s *Systemd) ForceStop(svc string) error {
|
||||
_, err := s.r.RunCmd(exec.Command("sudo", "systemctl", "stop", "-f", svc))
|
||||
rr, err := s.r.RunCmd(exec.Command("sudo", "systemctl", "stop", "-f", svc))
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
if strings.Contains(rr.Output(), fmt.Sprintf("Unit %s not loaded", svc)) {
|
||||
// already stopped
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue