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

report hostname with output of scm_run.

This should make it easier to troubleshoot issues that
crop up when running the scm_command via a deployment
strategy.
This commit is contained in:
Jamis Buck 2008-05-31 10:03:29 -06:00
parent 3d3156fd82
commit d48ed9a986
6 changed files with 19 additions and 8 deletions

View file

@ -1,5 +1,7 @@
*unreleased*
* Make sure the host is reported with the output from scm_run [Jamis Buck]
* Make git SCM honor the :scm_verbose option [Jamis Buck]
* Don't follow symlinks when using :copy_cache [Jamis Buck]

View file

@ -227,7 +227,8 @@ module Capistrano
# from the SCM. Password prompts, connection requests, passphrases,
# etc. are handled here.
def handle_data(state, stream, text)
logger.info "[#{stream}] #{text}"
host = state[:channel][:host]
logger.info "[#{host} :: #{stream}] #{text}"
case text
when /\bpassword.*:/i
# git is prompting for a password

View file

@ -67,7 +67,8 @@ module Capistrano
# user/pass can come from ssh and http distribution methods
# yes/no is for when ssh asks you about fingerprints
def handle_data(state, stream, text)
logger.info "[#{stream}] #{text}"
host = state[:channel][:host]
logger.info "[#{host} :: #{stream}] #{text}"
case text
when /^user:/mi
# support :scm_user for backwards compatibility of this module

View file

@ -68,7 +68,8 @@ module Capistrano
# from the SCM. Password prompts, connection requests, passphrases,
# etc. are handled here.
def handle_data(state, stream, text)
logger.info "[#{stream}] #{text}"
host = state[:channel][:host]
logger.info "[#{host} :: #{stream}] #{text}"
case text
when /\bpassword.*:/i
# subversion is prompting for a password

View file

@ -27,7 +27,7 @@ module Capistrano
# #handle_data filter of the SCM implementation.
def scm_run(command)
run(command) do |ch,stream,text|
ch[:state] ||= {}
ch[:state] ||= { :channel => ch }
output = source.handle_data(ch[:state], stream, text)
ch.send_data(output) if output
end

View file

@ -43,10 +43,10 @@ class DeploySCMMercurialTest < Test::Unit::TestCase
require 'capistrano/logger'
@config[:scm_user] = "fred"
text = "user:"
assert_equal "fred\n", @source.handle_data(:test_state, :test_stream, text)
assert_equal "fred\n", @source.handle_data(mock_state, :test_stream, text)
# :scm_username takes priority
@config[:scm_username] = "wilma"
assert_equal "wilma\n", @source.handle_data(:test_state, :test_stream, text)
assert_equal "wilma\n", @source.handle_data(mock_state, :test_stream, text)
end
def test_sync
@ -67,7 +67,7 @@ class DeploySCMMercurialTest < Test::Unit::TestCase
require 'capistrano/logger'
text = "password:"
@config[:scm_password] = "opensesame"
assert_equal "opensesame\n", @source.handle_data(:test_state, :test_stream, text)
assert_equal "opensesame\n", @source.handle_data(mock_state, :test_stream, text)
end
def test_prompts_for_password_if_preferred
@ -76,7 +76,7 @@ class DeploySCMMercurialTest < Test::Unit::TestCase
Capistrano::CLI.stubs(:password_prompt).with("hg password: ").returns("opensesame")
@config[:scm_prefer_prompt] = true
text = "password:"
assert_equal "opensesame\n", @source.handle_data(:test_state, :test_stream, text)
assert_equal "opensesame\n", @source.handle_data(mock_state, :test_stream, text)
end
@ -120,4 +120,10 @@ class DeploySCMMercurialTest < Test::Unit::TestCase
assert_equal "hg", @source.local.command
assert_equal "/foo/bar/hg", @source.command
end
private
def mock_state
{ :channel => { :host => "abc" } }
end
end