From 46ef78d2d829eef2ef4a69392378d4d4ae95ec8e Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Wed, 28 Feb 2007 19:22:51 +0000 Subject: [PATCH] make sure the logger gets passed to the gateway, and log the server.host, instead of the server record git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@6269 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- lib/capistrano/configuration/connections.rb | 2 +- lib/capistrano/gateway.rb | 2 +- test/configuration/connections_test.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/capistrano/configuration/connections.rb b/lib/capistrano/configuration/connections.rb index 5d087223..0b01d490 100644 --- a/lib/capistrano/configuration/connections.rb +++ b/lib/capistrano/configuration/connections.rb @@ -52,7 +52,7 @@ module Capistrano if exists?(:gateway) logger.debug "establishing connection to gateway `#{fetch(:gateway)}'" - Gateway.new(ServerDefinition.new(fetch(:gateway)), options) + Gateway.new(ServerDefinition.new(fetch(:gateway)), options.merge(:logger => logger)) else DefaultConnectionFactory.new(options) end diff --git a/lib/capistrano/gateway.rb b/lib/capistrano/gateway.rb index 3cf1f097..d6a01b7c 100644 --- a/lib/capistrano/gateway.rb +++ b/lib/capistrano/gateway.rb @@ -75,7 +75,7 @@ module Capistrano # Net::SSH connection via that port. def connect_to(server) connection = nil - logger.trace "establishing connection to #{server} via gateway" if logger + logger.trace "establishing connection to `#{server.host}' via gateway" if logger local_port = next_port thread = Thread.new do diff --git a/test/configuration/connections_test.rb b/test/configuration/connections_test.rb index 6b907aa3..0e3030ad 100644 --- a/test/configuration/connections_test.rb +++ b/test/configuration/connections_test.rb @@ -65,7 +65,7 @@ class ConfigurationConnectionsTest < Test::Unit::TestCase def test_connection_factory_as_gateway_should_honor_config_options @config.values[:gateway] = "capistrano" @config.values.update(@ssh_options) - Capistrano::SSH.expects(:connect).with { |s,opts| s.host == "capistrano" && opts == @ssh_options }.yields(stub_everything) + Capistrano::SSH.expects(:connect).with { |s,opts| s.host == "capistrano" && opts == @ssh_options.merge(:logger => @config.logger) }.yields(stub_everything) assert_instance_of Capistrano::Gateway, @config.connection_factory end