Module: Oxidized::Input::CLI

Included in:
FTP, SSH, Telnet
Defined in:
lib/oxidized/input/cli.rb

Instance Method Summary collapse

Instance Method Details

#connect_cliObject



18
19
20
# File 'lib/oxidized/input/cli.rb', line 18

def connect_cli
  @post_login.each { |command, block| block ? block.call : (cmd command) }
end

#disconnect_cliObject



22
23
24
# File 'lib/oxidized/input/cli.rb', line 22

def disconnect_cli
  @pre_logout.each { |command, block| block ? block.call : (cmd command, nil) }
end

#getObject



11
12
13
14
15
16
# File 'lib/oxidized/input/cli.rb', line 11

def get
  connect_cli
  d = @node.model.get
  disconnect
  d
end

#initializeObject



5
6
7
8
9
# File 'lib/oxidized/input/cli.rb', line 5

def initialize
  @post_login = []
  @pre_logout = []
  @username, @password, @exec = nil
end

#password(re = /^Password/) ⇒ Object



42
43
44
# File 'lib/oxidized/input/cli.rb', line 42

def password re=/^Password/
  @password or @password = re
end

#post_login(_post_login = nil, &block) ⇒ Object



26
27
28
29
30
# File 'lib/oxidized/input/cli.rb', line 26

def  =nil, &block
  unless @exec
    @post_login << [, block]
  end
end

#pre_logout(_pre_logout = nil, &block) ⇒ Object



32
33
34
35
36
# File 'lib/oxidized/input/cli.rb', line 32

def pre_logout _pre_logout=nil, &block
  unless @exec
    @pre_logout <<  [_pre_logout, block]
  end
end

#username(re = /^(Username|login)/) ⇒ Object



38
39
40
# File 'lib/oxidized/input/cli.rb', line 38

def username re=/^(Username|login)/
  @username or @username = re
end