Class: Oxidized::FTP
- Includes:
- Input::CLI
- Defined in:
- lib/oxidized/input/ftp.rb
Constant Summary collapse
- RESCUE_FAIL =
{ debug: [ # Net::SSH::Disconnect, ], warn: [ # RuntimeError, # Net::SSH::AuthenticationFailed, ] }.freeze
Instance Attribute Summary
Attributes included from Input::CLI
Instance Method Summary collapse
- #cmd(file) ⇒ Object
-
#connect(node) ⇒ Object
rubocop:disable Naming/PredicateMethod.
- #connected? ⇒ Boolean
- #output ⇒ Object
-
#send(my_proc) ⇒ Object
meh not sure if this is the best way, but perhaps better than not implementing send.
Methods included from Input::CLI
#connect_cli, #disconnect_cli, #get, #initialize, #login, #newline, #password, #post_login, #pre_logout, #username
Methods included from Config::Vars
Instance Method Details
#cmd(file) ⇒ Object
32 33 34 35 |
# File 'lib/oxidized/input/ftp.rb', line 32 def cmd(file) logger.debug "FTP: #{file} @ #{@node.name}" @ftp.getbinaryfile file, nil end |
#connect(node) ⇒ Object
rubocop:disable Naming/PredicateMethod
18 19 20 21 22 23 24 25 26 |
# File 'lib/oxidized/input/ftp.rb', line 18 def connect(node) # rubocop:disable Naming/PredicateMethod @node = node @node.model.cfg['ftp'].each { |cb| instance_exec(&cb) } @log = File.open(Oxidized::Config::LOG + "/#{@node.ip}-ftp", 'w') if Oxidized.config.input.debug? @ftp = Net::FTP.new(@node.ip) @ftp.passive = Oxidized.config.input.ftp.passive @ftp.login @node.auth[:username], @node.auth[:password] connected? end |
#connected? ⇒ Boolean
28 29 30 |
# File 'lib/oxidized/input/ftp.rb', line 28 def connected? @ftp && (not @ftp.closed?) end |
#output ⇒ Object
42 43 44 |
# File 'lib/oxidized/input/ftp.rb', line 42 def output "" end |
#send(my_proc) ⇒ Object
meh not sure if this is the best way, but perhaps better than not implementing send
38 39 40 |
# File 'lib/oxidized/input/ftp.rb', line 38 def send(my_proc) my_proc.call end |