lib/rcmd.rb in rcmd-1.5.6 vs lib/rcmd.rb in rcmd-1.5.7
- old
+ new
@@ -34,10 +34,13 @@
# Boolean for disabling STDOUT output. SDTERR is always displayed. (Optional)
attr_accessor :quiet
# Array containing the current iterations thread objects.
attr_accessor :threads
+
+ # Boolean for debug output
+ attr_accessor :debug
end
# Main method for this module which should be called after the correct variables have been set.
#
# We iterate over the host list until it is empty, creating all
@@ -87,10 +90,11 @@
# Prepare threads
@threads = [ ]
num_threads.times do |i|
@threads[i] = Thread.new {
begin
- conn_options = { :user => @user, :host => @queue.pop, :password => nil, :quiet => @quiet}
+ conn_options = { :user => @user, :host => @queue.pop, :password => nil, :quiet => @quiet, :debug => @debug }
+ STDERR.print "DEBUG :: Connecting to #{conn_options[:host]}\n" if conn_options[:debug]
Net::SSH.start(conn_options[:host], conn_options[:user], :password => conn_options[:passwd]) do |session|
# Open channel for input/output control
session.open_channel do |channel|
channel.on_data do |ch, data|
# Print recieved data if quiet is not true