Skip to content

Commit 0241da3

Browse files
authored
Merge pull request kubernetes#120514 from fengxsong/patch-1
fix: check if initsystem service exists
2 parents f551940 + a69f56e commit 0241da3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func (sysd SystemdInitSystem) ServiceExists(service string) bool {
125125
args := []string{"status", service}
126126
outBytes, _ := exec.Command("systemctl", args...).Output()
127127
output := string(outBytes)
128-
return !strings.Contains(output, "Loaded: not-found")
128+
return !strings.Contains(output, "Loaded: not-found") && !strings.Contains(output, "could not be found")
129129
}
130130

131131
// ServiceIsEnabled ensures the service is enabled to start on each boot.

0 commit comments

Comments
 (0)