Merge pull request #11472 from andriyDev/ErrorCodes

Use DRV_NOT_HEALTHY when at least one driver is installed but unhealthy
pull/11491/head
Medya Ghazizadeh 2021-05-21 11:33:23 -07:00 committed by GitHub
commit 3f2170bb51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View File

@ -605,7 +605,24 @@ func selectDriver(existing *config.ClusterConfig) (registry.DriverState, []regis
out.Infof("{{ .name }}: Suggestion: {{ .suggestion}}", out.V{"name": r.Name, "suggestion": r.Suggestion})
}
}
exit.Message(reason.DrvNotDetected, "No possible driver was detected. Try specifying --driver, or see https://minikube.sigs.k8s.io/docs/start/")
foundStoppedDocker := false
foundUnhealthy := false
for _, reject := range rejects {
if reject.Name == driver.Docker && reject.State.Installed && !reject.State.Running {
foundStoppedDocker = true
break
} else if reject.State.Installed && !reject.State.Healthy {
foundUnhealthy = true
break
}
}
if foundStoppedDocker {
exit.Message(reason.DrvDockerNotRunning, "Found docker, but the docker service isn't running. Try restarting the docker service.")
} else if foundUnhealthy {
exit.Message(reason.DrvNotHealthy, "Found driver(s) but none were healthy. See above for suggestions how to fix installed drivers.")
} else {
exit.Message(reason.DrvNotDetected, "No possible driver was detected. Try specifying --driver, or see https://minikube.sigs.k8s.io/docs/start/")
}
}
if len(alts) > 1 {

View File

@ -223,6 +223,8 @@ var (
DrvUnsupportedProfile = Kind{ID: "DRV_UNSUPPORTED_PROFILE", ExitCode: ExDriverUnsupported}
DrvNotFound = Kind{ID: "DRV_NOT_FOUND", ExitCode: ExDriverNotFound}
DrvNotDetected = Kind{ID: "DRV_NOT_DETECTED", ExitCode: ExDriverNotFound}
DrvNotHealthy = Kind{ID: "DRV_NOT_HEALTHY", ExitCode: ExDriverNotFound}
DrvDockerNotRunning = Kind{ID: "DRV_DOCKER_NOT_RUNNING", ExitCode: ExDriverNotFound}
DrvAsRoot = Kind{ID: "DRV_AS_ROOT", ExitCode: ExDriverPermission}
DrvNeedsRoot = Kind{ID: "DRV_NEEDS_ROOT", ExitCode: ExDriverPermission}
DrvNeedsAdministrator = Kind{ID: "DRV_NEEDS_ADMINISTRATOR", ExitCode: ExDriverPermission}