@@ -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
4856func 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
10893func 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