Skip to content

Commit

Permalink
fix connection problems when using gateways (closes #6913)
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@5832 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
jamis committed Jan 4, 2007
1 parent 066b200 commit deb7977
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
@@ -1,3 +1,7 @@
*SVN*

* Fix connection problems when using gateways [Ezra Zygmuntowicz]

*1.3.0* (December 23, 2006)

* Deprecate rake integration in favor of invoking `cap' directly [Jamis Buck]
Expand Down
12 changes: 5 additions & 7 deletions lib/capistrano/ssh.rb
Expand Up @@ -21,16 +21,14 @@ class SSH
def self.connect(server, config, port=22, &block)
methods = [ %w(publickey hostbased), %w(password keyboard-interactive) ]
password_value = nil

user, server_stripped, pport = parse_server(server)

begin
ssh_options = { :username => config.user,
ssh_options = { :username => (user || config.user),
:password => password_value,
:port => port,
:port => ((pport && pport != port) ? pport : port),
:auth_methods => methods.shift }.merge(config.ssh_options)

user, server_stripped, port = parse_server(server)
ssh_options[:username] = user if user
ssh_options[:port] = port if port

Net::SSH.start(server_stripped,ssh_options,&block)
rescue Net::SSH::AuthenticationFailed
Expand All @@ -40,7 +38,7 @@ def self.connect(server, config, port=22, &block)
end
end

# This regex is used for its byproducts, the $1-9 match vars.
# This regex is used for its byproducts, the $1-3 match vars.
# This regex will always match the ssh hostname and if there
# is a username or port they will be matched as well. This
# allows us to set the username and ssh port right in the
Expand Down

0 comments on commit deb7977

Please sign in to comment.