Skip to content

Commit

Permalink
Merge pull request #8023 from sharifelgamal/node-stop
Browse files Browse the repository at this point in the history
Fix missing node name in minikube stop output
  • Loading branch information
sharifelgamal authored May 6, 2020
2 parents 4607c0f + 5ed946c commit 80c3324
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions cmd/minikube/cmd/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/golang/glog"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/driver"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/kubeconfig"
Expand All @@ -51,10 +50,11 @@ func runStop(cmd *cobra.Command, args []string) {
defer api.Close()

for _, n := range cc.Nodes {
nonexistent := stop(api, *cc, n)
machineName := driver.MachineName(*cc, n)
nonexistent := stop(api, machineName)

if !nonexistent {
out.T(out.Stopped, `Node "{{.node_name}}" stopped.`, out.V{"node_name": n.Name})
out.T(out.Stopped, `Node "{{.node_name}}" stopped.`, out.V{"node_name": machineName})
}
}

Expand All @@ -67,9 +67,8 @@ func runStop(cmd *cobra.Command, args []string) {
}
}

func stop(api libmachine.API, cluster config.ClusterConfig, n config.Node) bool {
func stop(api libmachine.API, machineName string) bool {
nonexistent := false
machineName := driver.MachineName(cluster, n)

tryStop := func() (err error) {
err = machine.StopHost(api, machineName)
Expand Down

0 comments on commit 80c3324

Please sign in to comment.