I have a 13 windows servers running Jenkins Slaves. For some reason (windows updates?), the Jenkins slaves periodically quit working and the Jenkins Slave service needs to be r
I tried it out in Pry and found two issues:
host
as this is the variable being passed into the block.STRING
class, so add the .to_s
as indicated below.Also, I switched it to the idiomatic Ruby pattern of using do...end
when a block extends past 1 line.
hosts.each do |host|
puts "SSHing #{host} ..."
Net::SSH.start( host.to_s, USER, :password => PASS ) do |ssh|
puts ssh.exec!('date')
puts "Logging out..."
end
end
I tested this in Pry and it's now working. I hope this helps.