Class: Oxidized::FTP

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

Constant Summary

Constants inherited from Input

Input::RESCUE_FAIL

Instance Attribute Summary

Attributes included from Input::CLI

#node

Instance Method Summary collapse

Methods inherited from Input

config_name, #config_name, rescue_fail, to_sym, #to_sym

Methods included from Input::CLI

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

Methods included from Config::Vars

#vars

Instance Method Details

#cmd(file) ⇒ Object



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

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

#connect(node) ⇒ Object

rubocop:disable Naming/PredicateMethod



5
6
7
8
9
10
11
12
# File 'lib/oxidized/input/ftp.rb', line 5

def connect(node) # rubocop:disable Naming/PredicateMethod
  @node = node
  @node.model.cfg['ftp'].each { |cb| instance_exec(&cb) }
  @ftp = Net::FTP.new(@node.ip)
  @ftp.passive = Oxidized.config.input.ftp.passive
  @ftp. @node.auth[:username], @node.auth[:password]
  connected?
end

#connected?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/oxidized/input/ftp.rb', line 14

def connected?
  @ftp && (not @ftp.closed?)
end

#outputObject



28
29
30
# File 'lib/oxidized/input/ftp.rb', line 28

def output
  ""
end

#send(my_proc) ⇒ Object

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



24
25
26
# File 'lib/oxidized/input/ftp.rb', line 24

def send(my_proc)
  my_proc.call
end