Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing node name in minikube stop output #8023

Merged
merged 1 commit into from
May 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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