Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rubygems'
- require 'net/ssh/multi'
- require 'net/ssh'
- require 'getConf'
- require 'Auth'
- _timeout_ = 3
- ## Récupération de la configuration
- GetValues.new('config.yaml')
- Net::SSH::Multi.start do |session|
- Auth.all.each do |auth|
- begin
- puts "Attempting to connect @ " + auth.host
- session.use auth.host , :user => auth.username , :password => auth.password, :timeout => _timeout_
- session.exec 'pwd'
- rescue Timeout::Error => e
- puts " >>>> #{e}"
- rescue SystemCallError => e
- puts " >>>> #{e}"
- rescue Net::SSH::Exception => e
- puts " >>>> #{e}"
- else
- puts " >>>> Auth OK -- #{auth.username}:#{auth.password}@#{auth.host}"
- end
- end
- end
Add Comment
Please, Sign In to add comment