diff --git a/lib/stemcell/command_line.rb b/lib/stemcell/command_line.rb index 73b6774..4879f4e 100644 --- a/lib/stemcell/command_line.rb +++ b/lib/stemcell/command_line.rb @@ -95,14 +95,15 @@ def launch_instance(role, options={}) def tail_converge(instances, options={}) puts "\nTailing the initial converge. Press Ctrl-C to exit...".green - if instances.count > 1 - puts "\nYou're launching more than one instance." - puts "Showing you on the output from #{instances.first.instance_id}." - end - puts "\n" - tailer = LogTailer.new(instances.first.public_dns_name, options['ssh_user']) - tailer.run! + tailing_threads = instances.map do |instance| + Thread.new do + tailer = LogTailer.new(instance.public_dns_name, options['ssh_user']) + tailer.run! + puts "Finished #{instance.public_dns_name} => #{instance.id}" + end + end + tailing_threads.each(&:join) end def retrieve_defaults diff --git a/lib/stemcell/log_tailer.rb b/lib/stemcell/log_tailer.rb index ed1cbc3..6254433 100644 --- a/lib/stemcell/log_tailer.rb +++ b/lib/stemcell/log_tailer.rb @@ -77,14 +77,22 @@ def wait_for_ssh end puts " UP!".green - puts "Server responded with: #{banner.green}" + puts "Server responded with: #{banner.strip.green}" true end def tail_until_interrupt return if interrupted - session = Net::SSH.start(hostname, username) + print "Starting connection " + begin + session = Net::SSH.start(hostname, username) + rescue Net::SSH::AuthenticationFailed + print "." + sleep 5 + retry + end + puts " STARTED!".green channel = session.open_channel do |ch| ch.request_pty do |ch, success| @@ -137,7 +145,7 @@ def while_catching_interrupt trap(:SIGINT) { @interrupted = true } yield ensure - trap(:SIGINT, nil) + trap(:SIGINT, nil) end end end