Class: Oxidized::Script

Inherits:
Object
  • Object
show all
Defined in:
lib/oxidized/script/cli.rb,
lib/oxidized/script/script.rb,
lib/oxidized/script/command.rb,
lib/oxidized/script/commands/list-nodes.rb,
lib/oxidized/script/commands/list-models.rb

Defined Under Namespace

Modules: Command Classes: CLI, InvalidOption, NoConnection, NoNode, ScriptError

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model.



7
8
9
# File 'lib/oxidized/script/script.rb', line 7

def model
  @model
end

Instance Method Details

#cmd(command) ⇒ String

Returns output for command.

Parameters:

  • command (String)

    command to be sent

Returns:

  • (String)

    output for command



19
20
21
22
23
24
25
26
# File 'lib/oxidized/script/script.rb', line 19

def cmd command
  out = ''
  out += "## HOST - #{@host}\n" if @verbose
  out += "## OXS - #{command}\n" if @verbose
  cmd_out = @model.cmd command
  out += cmd_out if cmd_out
  out
end

#disconnectvoid Also known as: close

This method returns an undefined value.

disconnects from ssh/telnet session



30
31
32
# File 'lib/oxidized/script/script.rb', line 30

def disconnect
  @input.disconnect_cli
end