Method: Oxidized::Telnet#cmd

Defined in:
lib/oxidized/input/telnet.rb

#cmd(cmd_str, expect = @node.prompt) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/oxidized/input/telnet.rb', line 38

def cmd(cmd_str, expect = @node.prompt)
  logger.debug "Telnet: #{cmd_str} @#{@node.name}"
  return send(cmd_str + "\r\n") unless expect

  # create a string to be passed to oxidized_expect and modified _there_
  # default to a single space so it shouldn't be coerced to nil by any models.
  out = String(' ')
  @telnet.puts(cmd_str)
  @telnet.oxidized_expect(timeout: @timeout, expect: expect, out: out)
  out
end