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

user can provide global ssh settings

for example in deploy.rb:

      {
         keys: %w(/home/user/.ssh/id_rsa),
         forward_agent: false,
         auth_methods: %w(publickey password)
      }
This commit is contained in:
Rafał Lisowski 2013-07-11 17:38:55 +02:00
parent 391468e239
commit e49733f3ef
3 changed files with 13 additions and 4 deletions

View file

@ -59,6 +59,7 @@ module Capistrano
sshkit.backend.configure do |backend|
backend.pty = fetch(:pty)
backend.connection_timeout = fetch(:connection_timeout)
backend.ssh_options = fetch(:ssh_options) if fetch(:ssh_options)
end
end
end

View file

@ -234,6 +234,11 @@ describe Capistrano::DSL do
dsl.set(:default_env, default_env)
dsl.set(:pty, true)
dsl.set(:connection_timeout, 10)
dsl.set(:ssh_options, {
keys: %w(/home/user/.ssh/id_rsa),
forward_agent: false,
auth_methods: %w(publickey password)
})
dsl.configure_backend
end
@ -256,6 +261,13 @@ describe Capistrano::DSL do
it 'sets the backend connection timeout' do
expect(backend.connection_timeout).to eq 10
end
it 'sets the backend ssh_options' do
expect(backend.ssh_options[:keys]).to eq %w(/home/user/.ssh/id_rsa)
expect(backend.ssh_options[:forward_agent]).to eq false
expect(backend.ssh_options[:auth_methods]).to eq %w(publickey password)
end
end
end

View file

@ -137,10 +137,6 @@ module Capistrano
describe 'assign ssh_options' do
let(:server) { Server.new('user_name@hostname') }
# before do
# server
# end
context 'defaults' do
it 'forward agent' do
expect(server.netssh_options[:forward_agent]).to eq true