From 2178ea69fac4bdadb01e0decf6d32842d983d3ec Mon Sep 17 00:00:00 2001 From: Kevin Orel Edry Date: Sat, 17 Oct 2020 09:19:52 +0300 Subject: [PATCH 1/2] fixed ssh key error to better reflect its state --- internal/cmd/configssh.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/cmd/configssh.go b/internal/cmd/configssh.go index 5da6745c..0387f252 100644 --- a/internal/cmd/configssh.go +++ b/internal/cmd/configssh.go @@ -130,11 +130,12 @@ func configSSH(configpath *string, remove *bool) func(cmd *cobra.Command, _ []st } err = writeSSHKey(ctx, client, privateKeyFilepath) if err != nil { - return xerrors.Errorf("fetch and write ssh key: %w", err) + fmt.Printf("Your private ssh key already exists at \"%s\"\n", privateKeyFilepath) + } else { + fmt.Printf("Your private ssh key was written to \"%s\"\n", privateKeyFilepath) } fmt.Printf("An auto-generated ssh config was written to \"%s\"\n", *configpath) - fmt.Printf("Your private ssh key was written to \"%s\"\n", privateKeyFilepath) fmt.Println("You should now be able to ssh into your environment") fmt.Printf("For example, try running\n\n\t$ ssh coder.%s\n\n", envs[0].Name) return nil From 416b4868689ac8383d43fb03582f5999c8e71ce4 Mon Sep 17 00:00:00 2001 From: Charles Moog Date: Sat, 17 Oct 2020 01:30:24 -0500 Subject: [PATCH 2/2] Update internal/cmd/configssh.go --- internal/cmd/configssh.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/cmd/configssh.go b/internal/cmd/configssh.go index 0387f252..2bf2133c 100644 --- a/internal/cmd/configssh.go +++ b/internal/cmd/configssh.go @@ -130,7 +130,7 @@ func configSSH(configpath *string, remove *bool) func(cmd *cobra.Command, _ []st } err = writeSSHKey(ctx, client, privateKeyFilepath) if err != nil { - fmt.Printf("Your private ssh key already exists at \"%s\"\n", privateKeyFilepath) + fmt.Printf("Your private ssh key already exists at \"%s\"\nYou may need to remove the existing file and re-run this command\n", privateKeyFilepath) } else { fmt.Printf("Your private ssh key was written to \"%s\"\n", privateKeyFilepath) }