Fix node start

pull/8169/head
Sharif Elgamal 2020-05-15 17:20:33 -07:00
parent bf1284b9c2
commit 6d12ca7e5c
2 changed files with 9 additions and 5 deletions

View File

@ -20,6 +20,7 @@ import (
"os"
"github.com/spf13/cobra"
"k8s.io/minikube/pkg/minikube/driver"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/machine"
"k8s.io/minikube/pkg/minikube/mustload"
@ -39,16 +40,17 @@ var nodeStartCmd = &cobra.Command{
api, cc := mustload.Partial(ClusterFlagValue())
name := args[0]
if machine.IsRunning(api, name) {
out.T(out.Check, "{{.name}} is already running", out.V{"name": name})
os.Exit(0)
}
n, _, err := node.Retrieve(cc, name)
if err != nil {
exit.WithError("retrieving node", err)
}
machineName := driver.MachineName(*cc, *n)
if machine.IsRunning(api, machineName) {
out.T(out.Check, "{{.name}} is already running", out.V{"name": name})
os.Exit(0)
}
r, p, m, h, err := node.Provision(cc, n, false)
if err != nil {
exit.WithError("provisioning host for node", err)
@ -71,6 +73,7 @@ var nodeStartCmd = &cobra.Command{
exit.WithError("failed to start node", err)
}
}
out.T(out.Happy, "Successfully started node {{.name}}!", out.V{"name": machineName})
},
}

View File

@ -49,6 +49,7 @@ var nodeStopCmd = &cobra.Command{
if err != nil {
out.FatalT("Failed to stop node {{.name}}", out.V{"name": name})
}
out.T(out.Stopped, "Successfully stopped node {{.name}}", out.V{"name": machineName})
},
}