mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
fix connection problems when using gateways (closes #6913)
git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@5832 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
b01cbe6766
commit
340869a2c8
2 changed files with 9 additions and 7 deletions
|
@ -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]
|
||||
|
|
|
@ -21,16 +21,14 @@ module Capistrano
|
|||
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
|
||||
|
@ -40,7 +38,7 @@ module Capistrano
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue