mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
On OpenRC ServiceIsActive should not report true if no such service exists
This commit is contained in:
parent
449fe0b1ba
commit
947d696021
@ -65,8 +65,9 @@ func (openrc OpenRCInitSystem) ServiceIsEnabled(service string) bool {
|
||||
// ServiceIsActive ensures the service is running, or attempting to run. (crash looping in the case of kubelet)
|
||||
func (openrc OpenRCInitSystem) ServiceIsActive(service string) bool {
|
||||
args := []string{service, "status"}
|
||||
outBytes, _ := exec.Command("rc-service", args...).Output()
|
||||
return !strings.Contains(string(outBytes), "stopped")
|
||||
outBytes, _ := exec.Command("rc-service", args...).CombinedOutput()
|
||||
outStr := string(outBytes)
|
||||
return !strings.Contains(outStr, "stopped") && !strings.Contains(outStr, "does not exist")
|
||||
}
|
||||
|
||||
// EnableCommand return a string describing how to enable a service
|
||||
|
Loading…
Reference in New Issue
Block a user