Class: Oxidized::FTP

Inherits:
Input
  • Object
show all
Includes:
Input::CLI
Defined in:
lib/oxidized/input/ftp.rb

Constant Summary collapse

RescueFail =
{
  :debug => [
    #Net::SSH::Disconnect,
  ],
  :warn => [
    #RuntimeError,
    #Net::SSH::AuthenticationFailed,
  ],
}

Instance Method Summary collapse

Methods included from Input::CLI

#connect_cli, #disconnect_cli, #get, #initialize, #password, #post_login, #pre_logout, #username

Methods included from Config::Vars

#vars

Instance Method Details

#cmd(file) ⇒ Object



30
31
32
33
# File 'lib/oxidized/input/ftp.rb', line 30

def cmd file
  Log.debug "FTP: #{file} @ #{@node.name}"
  @ftp.getbinaryfile file, nil
end

#connect(node) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/oxidized/input/ftp.rb', line 18

def connect node
  @node       = node
  @node.model.cfg['ftp'].each { |cb| instance_exec(&cb) }
  @log = File.open(Oxidized::Config::Crash + "-#{@node.ip}-ftp", 'w') if CFG.input.debug?
  @ftp = Net::FTP.new @node.ip, @node.auth[:username], @node.auth[:password]
  connected?
end

#connected?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/oxidized/input/ftp.rb', line 26

def connected?
  @ftp and not @ftp.closed?
end

#outputObject



40
41
42
# File 'lib/oxidized/input/ftp.rb', line 40

def output
  ""
end

#send(my_proc) ⇒ Object

meh not sure if this is the best way, but perhaps better than not implementing send



36
37
38
# File 'lib/oxidized/input/ftp.rb', line 36

def send my_proc
  my_proc.call
end