Remove duplicate handling of driver conflict, handle driver not-found case

pull/5401/head
Thomas Stromberg 2019-09-18 15:29:27 -07:00
parent 2526a9cd28
commit eca5c996a4
2 changed files with 3 additions and 10 deletions

View File

@ -510,11 +510,11 @@ func selectDriver(oldConfig *cfg.Config) string {
return driver
}
if h.Driver.DriverName() == driver {
if h.Driver.DriverName() == driver || h.Driver.DriverName() == "not-found" {
return driver
}
out.ErrT(out.Conflict, `You have an existing "{{.profile_name}}" VM that was created using the "{{.old_driver}}" driver, and is incompatible with the "{{.driver}}" driver.`,
out.ErrT(out.Conflict, `The existing "{{.profile_name}}" VM that was created using the "{{.old_driver}}" driver, and is incompatible with the "{{.driver}}" driver.`,
out.V{"profile_name": cfg.GetMachineName(), "driver": driver, "old_driver": h.Driver.DriverName()})
out.ErrT(out.Workaround, `To proceed, either:

View File

@ -102,14 +102,7 @@ func StartHost(api libmachine.API, config cfg.MachineConfig) (*host.Host, error)
return nil, errors.Wrap(err, "Error loading existing host. Please try running [minikube delete], then run [minikube start] again.")
}
if h.Driver.DriverName() != config.VMDriver {
out.T(out.Empty, "\n")
exit.WithCodeT(exit.Config, `The existing "{{.profile_name}}" VM was created using the {{.driver_name}} driver.`,
out.V{"profile_name": cfg.GetMachineName(), "driver_name": config.VMDriver})
out.WarningT("To switch drivers, you may create a new VM using `minikube start -p <name> --vm-driver={{.driver_name}}`", out.V{"driver_name": config.VMDriver})
out.WarningT("Alternatively, you may delete the existing VM using `minikube delete -p {{.profile_name}}`", out.V{"profile_name": cfg.GetMachineName()})
out.T(out.Empty, "\n")
} else if exists && cfg.GetMachineName() == constants.DefaultMachineName {
if exists && cfg.GetMachineName() == constants.DefaultMachineName {
out.T(out.Tip, "Tip: Use 'minikube start -p <name>' to create a new cluster, or 'minikube delete' to delete this one.")
}