Guest User

Untitled

a guest
Oct 19th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. require 'rubygems'
  2. require 'net/ssh/multi'
  3. require 'net/ssh'
  4. require 'getConf'
  5. require 'Auth'
  6.  
  7. _timeout_ = 3
  8.  
  9. ## Récupération de la configuration
  10. GetValues.new('config.yaml')
  11.  
  12.  
  13. Net::SSH::Multi.start do |session|
  14. Auth.all.each do |auth|
  15. begin
  16. puts "Attempting to connect @ " + auth.host
  17. session.use auth.host , :user => auth.username , :password => auth.password, :timeout => _timeout_
  18. session.exec 'pwd'
  19. rescue Timeout::Error => e
  20. puts " >>>> #{e}"
  21. rescue SystemCallError => e
  22. puts " >>>> #{e}"
  23. rescue Net::SSH::Exception => e
  24. puts " >>>> #{e}"
  25. else
  26. puts " >>>> Auth OK -- #{auth.username}:#{auth.password}@#{auth.host}"
  27. end
  28. end
  29. end
Add Comment
Please, Sign In to add comment