mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #86508 from kvaster/master
On OpenRC ServiceIsActive should not report true if no such service exists
This commit is contained in:
commit
1ca0f89aa1
@ -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