From 5906bd3b93e38c46b7f805db0cc2097434220c5d Mon Sep 17 00:00:00 2001 From: Medya Ghazizadeh Date: Mon, 15 Sep 2025 13:44:55 -0700 Subject: [PATCH] add path to the error msg --- cmd/minikube/cmd/start.go | 4 +-- pkg/minikube/driver/auxdriver/install.go | 37 ++++++++---------------- 2 files changed, 14 insertions(+), 27 deletions(-) diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index d0e5a9868b..020cd198a9 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -535,10 +535,10 @@ func updateDriver(driverName string) { out.WarningT("Error parsing minikube version: {{.error}}", out.V{"error": err}) } else if err := auxdriver.InstallOrUpdate(driverName, localpath.MakeMiniPath("bin"), v, viper.GetBool(interactive), viper.GetBool(autoUpdate)); err != nil { if errors.Is(err, auxdriver.ErrAuxDriverVersionCommandFailed) { - exit.Error(reason.DrvAuxNotHealthy, "Aux driver failed for:"+driverName, err) + exit.Error(reason.DrvAuxNotHealthy, "Aux driver "+driverName, err) } if errors.Is(err, auxdriver.ErrAuxDriverVersionNotinPath) { - exit.Error(reason.DrvAuxNotHealthy, "Aux driver not found in path "+driverName, err) + exit.Error(reason.DrvAuxNotHealthy, "Aux driver"+driverName, err) } //if failed to update but not a fatal error, log it and continue (old version might still work) out.WarningT("Unable to update {{.driver}} driver: {{.error}}", out.V{"driver": driverName, "error": err}) } diff --git a/pkg/minikube/driver/auxdriver/install.go b/pkg/minikube/driver/auxdriver/install.go index aea8e3b045..ce90367434 100644 --- a/pkg/minikube/driver/auxdriver/install.go +++ b/pkg/minikube/driver/auxdriver/install.go @@ -38,11 +38,19 @@ import ( "k8s.io/minikube/pkg/util/lock" ) +func newAuxUnthealthyError(path string) error { + return errors.New(fmt.Sprintf(`failed to execute auxiliary version command "%s --version"`, path)) +} + +func newAuxNotFoundError(path string) error { + return errors.New(fmt.Sprintf("auxiliary not pound in path command %s", path)) +} + // ErrAuxDriverVersionCommandFailed indicates the aux driver 'version' command failed to run -var ErrAuxDriverVersionCommandFailed = errors.New("failed to execute auxiliary driver version command") +var ErrAuxDriverVersionCommandFailed error // ErrAuxDriverVersionNotinPath was not found in PATH -var ErrAuxDriverVersionNotinPath = errors.New("auxiliary driver was not found in path") +var ErrAuxDriverVersionNotinPath error // InstallOrUpdate downloads driver if it is not present, or updates it if there's a newer version func InstallOrUpdate(name string, directory string, v semver.Version, interactive bool, autoUpdate bool) error { @@ -81,29 +89,6 @@ func InstallOrUpdate(name string, directory string, v semver.Version, interactiv return nil } -// verifyExecutes ensures the installed auxiliary driver binary executes successfully. -func verifyExecutes(name string) error { - if name != driver.KVM2 && name != driver.HyperKit { - return nil - } - - executable := fmt.Sprintf("docker-machine-driver-%s", name) - path, err := exec.LookPath(executable) - if err != nil { - return ErrAuxDriverVersionNotinPath - } - - cmd := exec.Command(path, "version") - output, err := cmd.CombinedOutput() - if err != nil { - details := strings.TrimSpace(string(output)) - klog.Warningf("%s failed: %v: %s", strings.Join(cmd.Args, " "), err, details) - return ErrAuxDriverVersionCommandFailed - } - - return nil -} - // fixDriverPermissions fixes the permissions on a driver func fixDriverPermissions(name string, path string, interactive bool) error { if name != driver.HyperKit { @@ -154,6 +139,7 @@ func validateDriver(executable string, v semver.Version) (string, error) { path, err := exec.LookPath(executable) if err != nil { klog.Warningf("driver not in path : %s, %v", path, err.Error()) + ErrAuxDriverVersionNotinPath = newAuxNotFoundError(path) return path, ErrAuxDriverVersionNotinPath } @@ -161,6 +147,7 @@ func validateDriver(executable string, v semver.Version) (string, error) { output, err := cmd.CombinedOutput() if err != nil { klog.Warningf("%s failed: %v: %s", strings.Join(cmd.Args, " "), err, output) + ErrAuxDriverVersionCommandFailed = newAuxUnthealthyError(path) return path, ErrAuxDriverVersionCommandFailed }