From 8cfe5c1a7ba7293341a0af49d000654c05a9b9ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20M=C3=BChlfort?= Date: Thu, 8 Oct 2020 09:18:37 +0200 Subject: [PATCH] Fix "--native-ssh" flag of "minikube ssh" In the previous state, the flag was discarded. This commit fixes that and also makes sure that the SSH client is created after the default client type is configured according to the flag. --- cmd/minikube/cmd/ssh.go | 2 +- pkg/minikube/machine/ssh.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/minikube/cmd/ssh.go b/cmd/minikube/cmd/ssh.go index 15f1d7233613..15621092476b 100644 --- a/cmd/minikube/cmd/ssh.go +++ b/cmd/minikube/cmd/ssh.go @@ -67,6 +67,6 @@ var sshCmd = &cobra.Command{ } func init() { - sshCmd.Flags().Bool(nativeSSH, true, "Use native Golang SSH client (default true). Set to 'false' to use the command line 'ssh' command when accessing the docker machine. Useful for the machine drivers when they will not start with 'Waiting for SSH'.") + sshCmd.Flags().BoolVar(&nativeSSHClient, "native-ssh", true, "Use native Golang SSH client (default true). Set to 'false' to use the command line 'ssh' command when accessing the docker machine. Useful for the machine drivers when they will not start with 'Waiting for SSH'.") sshCmd.Flags().StringVarP(&nodeName, "node", "n", "", "The node to ssh into. Defaults to the primary control plane.") } diff --git a/pkg/minikube/machine/ssh.go b/pkg/minikube/machine/ssh.go index 0f991e2f2ce2..c547ed09d7d2 100644 --- a/pkg/minikube/machine/ssh.go +++ b/pkg/minikube/machine/ssh.go @@ -42,14 +42,14 @@ func CreateSSHShell(api libmachine.API, cc config.ClusterConfig, n config.Node, return errors.Errorf("%q is not running", machineName) } - client, err := host.CreateSSHClient() - if native { ssh.SetDefaultClient(ssh.Native) } else { ssh.SetDefaultClient(ssh.External) } + client, err := host.CreateSSHClient() + if err != nil { return errors.Wrap(err, "Creating ssh client") }