From 97e4328d5bc9bdd43c228b344527921d8dfadd40 Mon Sep 17 00:00:00 2001 From: Mike Gehard Date: Sun, 27 Feb 2011 16:54:05 -0700 Subject: [PATCH] If you set an level of verboseness on cap, Net::SSH will set verboseness to debug. --- lib/capistrano/ssh.rb | 2 ++ test/ssh_test.rb | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/lib/capistrano/ssh.rb b/lib/capistrano/ssh.rb index 1f9540ba..84bb9692 100644 --- a/lib/capistrano/ssh.rb +++ b/lib/capistrano/ssh.rb @@ -69,6 +69,8 @@ module Capistrano # Once we've loaded the config, we don't need Net::SSH to do it again. ssh_options[:config] = false + ssh_options[:verbose] = :debug if options[:verbose] && options[:verbose] > 0 + user = server.user || options[:user] || ssh_options[:username] || ssh_options[:user] || ServerDefinition.default_user port = server.port || options[:port] || ssh_options[:port] diff --git a/test/ssh_test.rb b/test/ssh_test.rb index 774c9a6b..9b3d350e 100644 --- a/test/ssh_test.rb +++ b/test/ssh_test.rb @@ -82,6 +82,15 @@ class SSHTest < Test::Unit::TestCase assert_equal success, Capistrano::SSH.connect(@server, :ssh_options => ssh_options, :user => "jamis", :port => 1235) end + def test_connect_with_verbose_option_should_set_verbose_option_on_ssh + Net::SSH.expects(:start).with(@server.host, "default-user", @options).returns(success = Object.new) + assert_equal success, Capistrano::SSH.connect(@server, :verbose => 0) + Net::SSH.expects(:start).with(@server.host, "default-user", @options.merge(:verbose => :debug)).returns(success = Object.new) + assert_equal success, Capistrano::SSH.connect(@server, :verbose => 1) + Net::SSH.expects(:start).with(@server.host, "default-user", @options.merge(:verbose => :debug)).returns(success = Object.new) + assert_equal success, Capistrano::SSH.connect(@server, :verbose => 2) + end + def test_connect_with_ssh_options_should_see_server_options_override_ssh_options ssh_options = { :username => "JamisMan", :port => 8125, :forward_agent => true } server = server("jamis@capistrano:1235")