diff options
author | MajesticFalcon <Schylarutley@hotmail.com> | 2016-08-30 18:20:31 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-30 18:20:31 -0500 |
commit | 5d99baa74881271af4e73a2072325b5959ed9371 (patch) | |
tree | 448954133a313385e15a0504221cfd5f168bdefd /lib | |
parent | f9bd7b3b3564d99fb34c82edfc6b779b76496758 (diff) |
Update tftp.rb
Diffstat (limited to 'lib')
-rw-r--r-- | lib/oxidized/input/tftp.rb | 35 |
1 files changed, 8 insertions, 27 deletions
diff --git a/lib/oxidized/input/tftp.rb b/lib/oxidized/input/tftp.rb index c2f3a16..18028c6 100644 --- a/lib/oxidized/input/tftp.rb +++ b/lib/oxidized/input/tftp.rb @@ -2,27 +2,19 @@ module Oxidized require 'timeout' require 'stringio' require_relative 'cli' - + + begin + require 'net/tftp' + rescue LoadError + raise OxidizedError, 'net/tftp not found: sudo gem install net-tftp' + end + class TFTP < Input - RescueFail = { - :debug => [ - #Net::SSH::Disconnect, - ], - :warn => [ - #RuntimeError, - #Net::SSH::AuthenticationFailed, - ], - } include Input::CLI # TFTP utilizes UDP, there is not a connection. We simply specify an IP and send/receive data. def connect node - begin - require 'net/tftp' - rescue LoadError - raise OxidizedError, 'net/tftp not found: sudo gem install net-tftp' - end @node = node @node.model.cfg['tftp'].each { |cb| instance_exec(&cb) } @@ -38,21 +30,10 @@ module Oxidized config.read end - - # meh not sure if this is the best way, but perhaps better than not implementing send - def send my_proc - my_proc.call - end - - def output - "" - end - private - + def disconnect # TFTP uses UDP, there is no connection to close - #rescue Errno::ECONNRESET, IOError ensure @log.close if Oxidized.config.input.debug? end |