Hi,
Is it possible to use previous gems to be used with Latest Ruby 1.9.2
Actually earlier i use Ruby 1.8.7 and netssh 1.1.2 and needle 1.3.0
I upgrade to Ruby 1.9.2.
However with Ruby 1.9.2,netssh and needle gems are intergrated, plz
correct me if im wrong, but for sure syntax are changed for netssh
commands.
I have code which i use to send commands to remote linux machine, which
is used to work preciously with Ruby 1.8.7 and netssh 1.1.2.
Code is like :
def issueCommandInKazBox(okMachine="", command="", matchLog="",
user=“admin”, passwd=“kazeon”)
puts " issueCommandInKazMachine=#{okMachine}"
puts " issueCommandInKazcommand=#{command}"
puts " issueCommandInKazstatus=#{matchLog}"
puts " issueCommandInKazuser=#{user}"
puts " issueCommandInKazpasswd=#{passwd}"
tempString = “”
Net::SSH.start(okMachine, user, :password => passwd, :paranoid => false
) do |session|
#Net::SSH.start(okMachine, user, passwd) do |session|
session.open_channel do |channel|
channel.on_success do
puts "shell was started successfully!"
puts "Adding command - #{command}..."
channel.send_data "#{command}\n"
channel.send_data "exit\n" # tell the shell to exit
end
channel.on_failure do
puts "shell could not be started!"
end
channel.on_data do |ch,data|
puts "recieved the following from shell"
puts "#{data}"
tempString = tempString + "\n" + data
end
channel.on_close do
puts "shell terminated"
end
channel.send_request "shell", nil, true
end
session.loop
end
$_ = tempString
$outputofissueCommandInKazBox = tempString
if /#{matchLog}/
puts “PASSED! issueCommandInKazBox - find match log - #{matchLog}”
return true
else
puts “FAILED! issueCommandInKazBox - could not find match log -
#{matchLog}”
return false
end
end
But now with Ruby 1.9.2 and netssh 2.1.4. This doesn;t work.
So is it possible to install ruby 1.9.2 and then netssh 1.1.2 and then
while executing scripts i can direct script to use netssh 1.1.2
installed dir command so that above code works.
Currently it throws me error like :
- Error:
test_0001(TC_I18N):
NoMethodError: undefined methodcritical=' for Thread:Class C:/Ruby192/lib/ruby/site_ruby/1.9.1/needle/thread.rb:42:in
lock’
internal:prelude:8:insynchronize' C:/Ruby192/lib/ruby/site_ruby/1.9.1/needle/service-point.rb:117:in
instance
’
C:/Ruby192/lib/ruby/site_ruby/1.9.1/needle/container.rb:308:inget' C:/Ruby192/lib/ruby/site_ruby/1.9.1/needle/registry.rb:124:in
bootstrap’
C:/Ruby192/lib/ruby/site_ruby/1.9.1/needle/registry.rb:106:in
initialize' C:/Ruby192/lib/ruby/site_ruby/1.9.1/net/ssh/session.rb:265:in
new’
C:/Ruby192/lib/ruby/site_ruby/1.9.1/net/ssh/session.rb:265:in
process_argum ents' C:/Ruby192/lib/ruby/site_ruby/1.9.1/net/ssh/session.rb:107:in
initialize’
C:/Ruby192/lib/ruby/site_ruby/1.9.1/net/ssh.rb:50:innew' C:/Ruby192/lib/ruby/site_ruby/1.9.1/net/ssh.rb:50:in
start’
C:/IE_AUTOMATION/kazeon/qa/watir-v1_4-TIP/Lib/KazeonCommon/BasicMethodLibrar
y.rb:873:inissueCommandInKazBox' C:/IE_AUTOMATION/kazeon/qa/watir-v1_4-TIP/KazModules/I18N/I18N_Regression.rb :78:in
test_0001’
Bhavesh