Merge pull request #86508 from kvaster/master

On OpenRC ServiceIsActive should not report true if no such service exists
This commit is contained in:
Kubernetes Prow Robot 2019-12-24 01:05:29 -08:00 committed by GitHub
commit 1ca0f89aa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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