Skip to content
This repository has been archived by the owner on Nov 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #11 from zendesk/add-missing-extra-args-support
Browse files Browse the repository at this point in the history
Add missing ssh/scp extra args support
  • Loading branch information
emate authored Mar 14, 2019
2 parents b4b56db + edd7436 commit 46e2786
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 2 additions & 0 deletions cmd/scp.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ func scpCmdFunc(cmd *cobra.Command, args []string) {
cmd.Annotations["local_path"],
}
baseCommand := []string{config.GlobalConfig.ScpBinary}
baseCommand = append(baseCommand, config.GlobalConfig.ScpExtraParams...)

if checkIfRemotePath(cmd.Annotations["copy_from"]) {
baseCommand = append(baseCommand, command.CopyFromRemoteCmd()...)
} else {
Expand Down
9 changes: 6 additions & 3 deletions cmd/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,17 @@ func sshCmdFunc(cmd *cobra.Command, args []string) {
os.Exit(1)
}

sshCommandWithArgs := []string{
config.GlobalConfig.SSHBinary,
baseCommand := []string{config.GlobalConfig.SSHBinary}
baseCommand = append(baseCommand, config.GlobalConfig.SSHExtraParams...)

sshCommandWithArgs := append(baseCommand, []string{
fmt.Sprintf(
"%s@%s",
config.GlobalConfig.LoginUsername,
resource.ConnectIdentifier(config.GlobalConfig.UsePrivateNetwork, config.GlobalConfig.UseDNS),
),
}
}...)

color.PrintGreen(fmt.Sprintf("Logging into %s (%s)\n",
resource.Name(), resource.GetTag("environment")))

Expand Down
9 changes: 6 additions & 3 deletions cmd/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ func tunnelCmdFunc(cmd *cobra.Command, args []string) {
os.Exit(1)
}

tunnelCommand := []string{
config.GlobalConfig.SSHBinary,
baseCommand := []string{config.GlobalConfig.SSHBinary}
baseCommand = append(baseCommand, config.GlobalConfig.SSHExtraParams...)

tunnelCommand := append(baseCommand, []string{
fmt.Sprintf(
"%s@%s",
config.GlobalConfig.LoginUsername,
Expand All @@ -70,7 +72,8 @@ func tunnelCmdFunc(cmd *cobra.Command, args []string) {
cmd.Annotations["local_bind_address"],
cmd.Annotations["remote_bind_address"],
),
}
}...)

color.PrintGreen(fmt.Sprintf("Creating ssh tunnel to %s (%s)\n",
resource.Name(), resource.GetTag("environment")))

Expand Down

0 comments on commit 46e2786

Please sign in to comment.