Skip to content

Commit 1ca0f89

Browse files
authored
Merge pull request kubernetes#86508 from kvaster/master
On OpenRC ServiceIsActive should not report true if no such service exists
2 parents 1534443 + 947d696 commit 1ca0f89

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cmd/kubeadm/app/util/initsystem/initsystem_unix.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@ func (openrc OpenRCInitSystem) ServiceIsEnabled(service string) bool {
6565
// ServiceIsActive ensures the service is running, or attempting to run. (crash looping in the case of kubelet)
6666
func (openrc OpenRCInitSystem) ServiceIsActive(service string) bool {
6767
args := []string{service, "status"}
68-
outBytes, _ := exec.Command("rc-service", args...).Output()
69-
return !strings.Contains(string(outBytes), "stopped")
68+
outBytes, _ := exec.Command("rc-service", args...).CombinedOutput()
69+
outStr := string(outBytes)
70+
return !strings.Contains(outStr, "stopped") && !strings.Contains(outStr, "does not exist")
7071
}
7172

7273
// EnableCommand return a string describing how to enable a service

0 commit comments

Comments
 (0)