diff --git a/lib/capistrano/configuration.rb b/lib/capistrano/configuration.rb index 1c3c55d5..c2619413 100644 --- a/lib/capistrano/configuration.rb +++ b/lib/capistrano/configuration.rb @@ -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 diff --git a/spec/integration/dsl_spec.rb b/spec/integration/dsl_spec.rb index 5abd28c1..65fd100b 100644 --- a/spec/integration/dsl_spec.rb +++ b/spec/integration/dsl_spec.rb @@ -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 diff --git a/spec/lib/capistrano/configuration/server_spec.rb b/spec/lib/capistrano/configuration/server_spec.rb index d595f112..2deeb308 100644 --- a/spec/lib/capistrano/configuration/server_spec.rb +++ b/spec/lib/capistrano/configuration/server_spec.rb @@ -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