1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

Remove explicit SSH Port 22 to allow ssh configuration files to overwrite it.

This commit is contained in:
Ben Lavender 2008-06-18 16:19:52 +02:00 committed by Jamis Buck
parent a6223b3939
commit babc48a04c
4 changed files with 8 additions and 9 deletions

View file

@ -1,5 +1,7 @@
*unreleased*
* Let Net::SSH manage the default SSH port selection [Ben Lavender]
* Changed capture() helper to not raise an exception on error, but to warn instead [Jeff Forcier]

View file

@ -23,9 +23,6 @@ module Capistrano
attr_accessor :xserver
end
# The default port for SSH.
DEFAULT_PORT = 22
# An abstraction to make it possible to connect to the server via public key
# without prompting for the password. If the public key authentication fails
# this will fall back to password authentication.
@ -58,10 +55,11 @@ module Capistrano
methods = [ %w(publickey hostbased), %w(password keyboard-interactive) ]
password_value = nil
ssh_options = (server.options[:ssh_options] || {}).merge(options[:ssh_options] || {})
user = server.user || options[:user] || ssh_options[:username] || ServerDefinition.default_user
ssh_options[:port] = server.port || options[:port] || ssh_options[:port] || DEFAULT_PORT
ssh_options = (server.options[:ssh_options] || {}).merge(options[:ssh_options] || {})
user = server.user || options[:user] || ssh_options[:username] || ServerDefinition.default_user
port = server.port || options[:port] || ssh_options[:port]
ssh_options[:port] = port if port
ssh_options.delete(:username)
begin

View file

@ -60,7 +60,7 @@ class ConfigurationConnectionsTest < Test::Unit::TestCase
def test_connection_factory_should_return_gateway_instance_if_gateway_variable_is_set
@config.values[:gateway] = "j@capistrano"
Net::SSH::Gateway.expects(:new).with("capistrano", "j", :port => 22, :password => nil, :auth_methods => %w(publickey hostbased)).returns(stub_everything)
Net::SSH::Gateway.expects(:new).with("capistrano", "j", :password => nil, :auth_methods => %w(publickey hostbased)).returns(stub_everything)
assert_instance_of Capistrano::Configuration::Connections::GatewayConnectionFactory, @config.connection_factory
end
@ -324,4 +324,4 @@ class ConfigurationConnectionsTest < Test::Unit::TestCase
:max_hosts => options[:max_hosts]
)
end
end
end

View file

@ -5,7 +5,6 @@ class SSHTest < Test::Unit::TestCase
def setup
Capistrano::ServerDefinition.stubs(:default_user).returns("default-user")
@options = { :password => nil,
:port => 22,
:auth_methods => %w(publickey hostbased) }
@server = server("capistrano")
end