diff --git a/CHANGELOG b/CHANGELOG index 619d3a50..7379a49b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Don't retry failed connections if an explicit auth_methods list is given [Chris Farms] + * Added support for load and exit callbacks, which get invoked when all recipes have been loaded and when all requested tasks have been executed [Jamis Buck] * Added support for start and finish callbacks, which get invoked when any task is called via the command-line [Jamis Buck] diff --git a/lib/capistrano/ssh.rb b/lib/capistrano/ssh.rb index b70c72fc..460a9dde 100644 --- a/lib/capistrano/ssh.rb +++ b/lib/capistrano/ssh.rb @@ -52,7 +52,7 @@ module Capistrano Server.apply_to(connection, server) rescue Net::SSH::AuthenticationFailed - raise if methods.empty? + raise if methods.empty? || options[:ssh_options] && options[:ssh_options][:auth_methods] password_value = options[:password] retry end diff --git a/test/ssh_test.rb b/test/ssh_test.rb index 011f72ce..b08b3780 100644 --- a/test/ssh_test.rb +++ b/test/ssh_test.rb @@ -83,4 +83,9 @@ class SSHTest < Test::Unit::TestCase assert success.respond_to?(:xserver) assert_equal success.xserver, @server end + + def test_connect_should_not_retry_if_custom_auth_methods_are_given + Net::SSH.expects(:start).with(@server.host, @options.merge(:auth_methods => %w(publickey))).raises(Net::SSH::AuthenticationFailed) + assert_raises(Net::SSH::AuthenticationFailed) { Capistrano::SSH.connect(@server, :ssh_options => { :auth_methods => %w(publickey) }) } + end end