diff options
-rwxr-xr-x | bin/oxidized | 2 | ||||
-rw-r--r-- | lib/oxidized/input/telnet.rb | 6 | ||||
-rw-r--r-- | lib/oxidized/model/model.rb | 5 | ||||
-rw-r--r-- | oxidized.gemspec | 2 |
4 files changed, 11 insertions, 4 deletions
diff --git a/bin/oxidized b/bin/oxidized index 564bb16..aee703f 100755 --- a/bin/oxidized +++ b/bin/oxidized @@ -8,7 +8,7 @@ rescue => e open Oxidized::Config::Crash, 'w' do |file| file.puts '-' * 50 file.puts Time.now.utc - file.puts e.message + file.puts e.message + ' [' + e.class.to_s + ']' file.puts '-' * 50 file.puts e.backtrace file.puts '-' * 50 diff --git a/lib/oxidized/input/telnet.rb b/lib/oxidized/input/telnet.rb index f946e92..2da459e 100644 --- a/lib/oxidized/input/telnet.rb +++ b/lib/oxidized/input/telnet.rb @@ -25,7 +25,11 @@ module Oxidized Log.debug "Telnet: #{cmd} @#{@node.name}" args = { 'String' => cmd } args.merge!({ 'Match' => expect, 'Timeout' => @timeout }) if expect - @telnet.cmd args + begin + @telnet.cmd args + rescue Timeout::Error + return false + end end private diff --git a/lib/oxidized/model/model.rb b/lib/oxidized/model/model.rb index fb27143..8f7b14f 100644 --- a/lib/oxidized/model/model.rb +++ b/lib/oxidized/model/model.rb @@ -40,6 +40,7 @@ module Oxidized def cmd string, &block out = @input.cmd string + return false unless out self.class.cmds[:all].each do |all_block| out = instance_exec out, &all_block end @@ -58,7 +59,9 @@ module Oxidized def get data = '' self.class.cmds[:cmd].each do |command, block| - data << (cmd command, &block).to_s + out = cmd command, &block + return false unless out + data << out.to_s end data << main.to_s if respond_to? :main data diff --git a/oxidized.gemspec b/oxidized.gemspec index 7a3d2cf..a1554f9 100644 --- a/oxidized.gemspec +++ b/oxidized.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'oxidized' - s.version = '0.0.1' + s.version = '0.0.3' s.platform = Gem::Platform::RUBY s.authors = [ 'Saku Ytti' ] s.email = %w( saku@ytti.fi ) |