mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 21:47:07 +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)
|
// ServiceIsActive ensures the service is running, or attempting to run. (crash looping in the case of kubelet)
|
||||||
func (openrc OpenRCInitSystem) ServiceIsActive(service string) bool {
|
func (openrc OpenRCInitSystem) ServiceIsActive(service string) bool {
|
||||||
args := []string{service, "status"}
|
args := []string{service, "status"}
|
||||||
outBytes, _ := exec.Command("rc-service", args...).Output()
|
outBytes, _ := exec.Command("rc-service", args...).CombinedOutput()
|
||||||
return !strings.Contains(string(outBytes), "stopped")
|
outStr := string(outBytes)
|
||||||
|
return !strings.Contains(outStr, "stopped") && !strings.Contains(outStr, "does not exist")
|
||||||
}
|
}
|
||||||
|
|
||||||
// EnableCommand return a string describing how to enable a service
|
// EnableCommand return a string describing how to enable a service
|
||||||
|
Loading…
Reference in New Issue
Block a user