Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Check for perm error in coder config-ssh #140

Merged
merged 1 commit into from
Oct 17, 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
Check for perm error in coder config-ssh
  • Loading branch information
cmoog committed Oct 17, 2020
commit 3f08540e4bc63b3020118b8a2df0ce9fce57bf19
5 changes: 4 additions & 1 deletion internal/cmd/configssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ 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\"\nYou may need to remove the existing file and re-run this command\n", privateKeyFilepath)
if !xerrors.Is(err, os.ErrPermission) {
return xerrors.Errorf("write ssh key: %w", err)
}
fmt.Printf("Your private ssh key already exists at \"%s\"\nYou may need to remove the existing private key file and re-run this command\n\n", privateKeyFilepath)
} else {
fmt.Printf("Your private ssh key was written to \"%s\"\n", privateKeyFilepath)
}
Expand Down