Skip to content

Commit

Permalink
check if machine exist or not
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravindra Ratnawat committed Dec 1, 2018
1 parent 603b65d commit 65cdd8c
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,13 +507,16 @@ func saveConfigToFile(data []byte, file string) error {

func ensureNotRunning(client libmachine.API, machineName string) {

hostVm, err := client.Load(machineName)
exists, _ := client.Exists(machineName)
if exists {
hostVm, err := client.Load(machineName)

if err != nil {
fmt.Fprintln(os.Stderr, fmt.Sprintf(err.Error()))
}
if drivers.MachineInState(hostVm.Driver, state.Running)() && hostVm.DriverName != "generic" {
fmt.Fprintln(os.Stdout, fmt.Sprintf("The '%s' VM is already running.", machineName))
os.Exit(0)
if err != nil {
fmt.Fprintln(os.Stderr, fmt.Sprintf(err.Error()))
}
if drivers.MachineInState(hostVm.Driver, state.Running)() && hostVm.DriverName != "generic" {
fmt.Fprintln(os.Stdout, fmt.Sprintf("The '%s' VM is already running.", machineName))
os.Exit(0)
}
}
}

0 comments on commit 65cdd8c

Please sign in to comment.