Skip to content

Commit 5906bd3

Browse files
committed
add path to the error msg
1 parent cca2b6a commit 5906bd3

File tree

2 files changed

+14
-27
lines changed

2 files changed

+14
-27
lines changed

cmd/minikube/cmd/start.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,10 +535,10 @@ func updateDriver(driverName string) {
535535
out.WarningT("Error parsing minikube version: {{.error}}", out.V{"error": err})
536536
} else if err := auxdriver.InstallOrUpdate(driverName, localpath.MakeMiniPath("bin"), v, viper.GetBool(interactive), viper.GetBool(autoUpdate)); err != nil {
537537
if errors.Is(err, auxdriver.ErrAuxDriverVersionCommandFailed) {
538-
exit.Error(reason.DrvAuxNotHealthy, "Aux driver failed for:"+driverName, err)
538+
exit.Error(reason.DrvAuxNotHealthy, "Aux driver "+driverName, err)
539539
}
540540
if errors.Is(err, auxdriver.ErrAuxDriverVersionNotinPath) {
541-
exit.Error(reason.DrvAuxNotHealthy, "Aux driver not found in path "+driverName, err)
541+
exit.Error(reason.DrvAuxNotHealthy, "Aux driver"+driverName, err)
542542
} //if failed to update but not a fatal error, log it and continue (old version might still work)
543543
out.WarningT("Unable to update {{.driver}} driver: {{.error}}", out.V{"driver": driverName, "error": err})
544544
}

pkg/minikube/driver/auxdriver/install.go

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,19 @@ import (
3838
"k8s.io/minikube/pkg/util/lock"
3939
)
4040

41+
func newAuxUnthealthyError(path string) error {
42+
return errors.New(fmt.Sprintf(`failed to execute auxiliary version command "%s --version"`, path))
43+
}
44+
45+
func newAuxNotFoundError(path string) error {
46+
return errors.New(fmt.Sprintf("auxiliary not pound in path command %s", path))
47+
}
48+
4149
// ErrAuxDriverVersionCommandFailed indicates the aux driver 'version' command failed to run
42-
var ErrAuxDriverVersionCommandFailed = errors.New("failed to execute auxiliary driver version command")
50+
var ErrAuxDriverVersionCommandFailed error
4351

4452
// ErrAuxDriverVersionNotinPath was not found in PATH
45-
var ErrAuxDriverVersionNotinPath = errors.New("auxiliary driver was not found in path")
53+
var ErrAuxDriverVersionNotinPath error
4654

4755
// InstallOrUpdate downloads driver if it is not present, or updates it if there's a newer version
4856
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
8189
return nil
8290
}
8391

84-
// verifyExecutes ensures the installed auxiliary driver binary executes successfully.
85-
func verifyExecutes(name string) error {
86-
if name != driver.KVM2 && name != driver.HyperKit {
87-
return nil
88-
}
89-
90-
executable := fmt.Sprintf("docker-machine-driver-%s", name)
91-
path, err := exec.LookPath(executable)
92-
if err != nil {
93-
return ErrAuxDriverVersionNotinPath
94-
}
95-
96-
cmd := exec.Command(path, "version")
97-
output, err := cmd.CombinedOutput()
98-
if err != nil {
99-
details := strings.TrimSpace(string(output))
100-
klog.Warningf("%s failed: %v: %s", strings.Join(cmd.Args, " "), err, details)
101-
return ErrAuxDriverVersionCommandFailed
102-
}
103-
104-
return nil
105-
}
106-
10792
// fixDriverPermissions fixes the permissions on a driver
10893
func fixDriverPermissions(name string, path string, interactive bool) error {
10994
if name != driver.HyperKit {
@@ -154,13 +139,15 @@ func validateDriver(executable string, v semver.Version) (string, error) {
154139
path, err := exec.LookPath(executable)
155140
if err != nil {
156141
klog.Warningf("driver not in path : %s, %v", path, err.Error())
142+
ErrAuxDriverVersionNotinPath = newAuxNotFoundError(path)
157143
return path, ErrAuxDriverVersionNotinPath
158144
}
159145

160146
cmd := exec.Command(path, "version")
161147
output, err := cmd.CombinedOutput()
162148
if err != nil {
163149
klog.Warningf("%s failed: %v: %s", strings.Join(cmd.Args, " "), err, output)
150+
ErrAuxDriverVersionCommandFailed = newAuxUnthealthyError(path)
164151
return path, ErrAuxDriverVersionCommandFailed
165152
}
166153

0 commit comments

Comments
 (0)