mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
pass the entire ssh_options Hash in a ServerDefinition's options to the Net:SSH.start call for that server
This commit is contained in:
parent
f0e5df5982
commit
4d587b336e
2 changed files with 8 additions and 2 deletions
|
@ -91,8 +91,8 @@ module Capistrano
|
|||
def self.connect(server, options={}, &block)
|
||||
methods = [ %w(publickey hostbased), %w(password keyboard-interactive) ]
|
||||
password_value = nil
|
||||
|
||||
ssh_options = (options[:ssh_options] || {}).dup
|
||||
|
||||
ssh_options = (server.options[:ssh_options] || {}).dup.merge(options[:ssh_options] || {}).dup
|
||||
ssh_options[:username] = server.user || options[:user] || ssh_options[:username]
|
||||
ssh_options[:port] = server.port || options[:port] || ssh_options[:port] || DEFAULT_PORT
|
||||
|
||||
|
|
|
@ -63,6 +63,12 @@ class SSHTest < Test::Unit::TestCase
|
|||
assert_equal success, Capistrano::SSH.connect(server)
|
||||
end
|
||||
|
||||
def test_connect_with_server_with_other_ssh_options_should_pass_ssh_options_to_net_ssh
|
||||
server = server("jamis@capistrano:1235", :ssh_options => { :keys => %w(some_valid_key), :auth_methods => %w(a_method), :hmac => 'none' })
|
||||
Net::SSH.expects(:start).with(server.host, @options.merge(:username => "jamis", :port => 1235, :keys => %w(some_valid_key), :auth_methods => %w(a_method), :hmac => 'none' )).returns(success = Object.new)
|
||||
assert_equal success, Capistrano::SSH.connect(server)
|
||||
end
|
||||
|
||||
def test_connect_with_ssh_options_should_use_ssh_options
|
||||
ssh_options = { :username => "JamisMan", :port => 8125 }
|
||||
Net::SSH.expects(:start).with(@server.host, @options.merge(:username => "JamisMan", :port => 8125)).returns(success = Object.new)
|
||||
|
|
Loading…
Reference in a new issue