I am trying to set a boolean variable to toggle the logging path in the Net::Telnet module, ie:
telnetdebug = false
telnetlog = false
telnetlogfile = '/var/log/mcacheMonitor.telnet.log'
xmr = Net::Telnet.new("Host" => host,
"Timeout" => 10,
"Prompt" => /[#]\z/n,
'Waittime' => 0,
'Dump_log' => telnetdebug ? "mcmsDebug.log" : nil,
'Output_log' => telnetlog ? telnetlogfile : nil)
BUt this code produces the following error:
C:/Ruby192/lib/ruby/1.9.1/net/telnet.rb:300:in `initialize': can't convert nil into String (TypeError)
from C:/Ruby192/lib/ruby/1.9.1/net/telnet.rb:300:in `open'
from C:/Ruby192/lib/ruby/1.9.1/net/telnet.rb:300:in `initialize'
from mcw.rb:26:in `new'
from mcw.rb:26:in `<main>'