A
Athreya Vc
Hi,
I am trying to do ssh to multiple servers and get their versions using
ruby Net::SSH
When I assign a host name to a variable and used in Net::SSH it works
fine
server="test.server.com"
Net::SSH.start(server, USER, assword=>PASSWORD) do |ssh|
result=ssh.exec!('hostname')
puts result
end
Whereas I put the servername in file read it in to a array, use each
method for individual servers
SERVER_LIST.each do |server|
Net::SSH.start(server, USER, assword=>PASSWORD) do
|ssh|
host_name=ssh.exec!('hostname')
puts result
end
It fails with the error,
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.23/lib/net/ssh/transport/session.rb:65:in
`initialize': newline at the end of
hostname (SocketError)
from
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.23/lib/net/ssh/transport/session.rb:65:in
`open'
from
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.23/lib/net/ssh/transport/session.rb:65:in
`initialize'
from /usr/lib/ruby/1.8/timeout.rb:48:in `timeout'
from /usr/lib/ruby/1.8/timeout.rb:76:in `timeout'
from
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.23/lib/net/ssh/transport/session.rb:65:in
`initialize'
from
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.23/lib/net/ssh.rb:179:in `new'
from
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.23/lib/net/ssh.rb:179:in `start'
Am i missing something here?
Regards,
I am trying to do ssh to multiple servers and get their versions using
ruby Net::SSH
When I assign a host name to a variable and used in Net::SSH it works
fine
server="test.server.com"
Net::SSH.start(server, USER, assword=>PASSWORD) do |ssh|
result=ssh.exec!('hostname')
puts result
end
Whereas I put the servername in file read it in to a array, use each
method for individual servers
SERVER_LIST.each do |server|
Net::SSH.start(server, USER, assword=>PASSWORD) do
|ssh|
host_name=ssh.exec!('hostname')
puts result
end
It fails with the error,
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.23/lib/net/ssh/transport/session.rb:65:in
`initialize': newline at the end of
hostname (SocketError)
from
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.23/lib/net/ssh/transport/session.rb:65:in
`open'
from
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.23/lib/net/ssh/transport/session.rb:65:in
`initialize'
from /usr/lib/ruby/1.8/timeout.rb:48:in `timeout'
from /usr/lib/ruby/1.8/timeout.rb:76:in `timeout'
from
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.23/lib/net/ssh/transport/session.rb:65:in
`initialize'
from
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.23/lib/net/ssh.rb:179:in `new'
from
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.23/lib/net/ssh.rb:179:in `start'
Am i missing something here?
Regards,