diff options
Diffstat (limited to 'lib/oxidized')
| -rw-r--r-- | lib/oxidized/input/input.rb | 2 | ||||
| -rw-r--r-- | lib/oxidized/input/ssh.rb | 6 | ||||
| -rw-r--r-- | lib/oxidized/input/telnet.rb | 6 | 
3 files changed, 12 insertions, 2 deletions
| diff --git a/lib/oxidized/input/input.rb b/lib/oxidized/input/input.rb index a7fb16d..da8ff5d 100644 --- a/lib/oxidized/input/input.rb +++ b/lib/oxidized/input/input.rb @@ -1,4 +1,5 @@  module Oxidized +  class PromptUndetect < OxidizedError; end    class Input      include Oxidized::Config::Vars @@ -8,6 +9,7 @@ module Oxidized        ],        :warn => [          IOError, +        PromptUndetect,          Timeout::Error,          Errno::ECONNRESET,          Errno::EHOSTUNREACH, diff --git a/lib/oxidized/input/ssh.rb b/lib/oxidized/input/ssh.rb index 62a31eb..ec33d37 100644 --- a/lib/oxidized/input/ssh.rb +++ b/lib/oxidized/input/ssh.rb @@ -26,7 +26,11 @@ module Oxidized                              :paranoid => secure        unless @exec          shell_open @ssh -        @username ? shell_login : expect(@node.prompt) +        begin +          @username ? shell_login : expect(@node.prompt) +        rescue Timeout::Error +          raise PromptUndetect, [ @output, 'not matching configured prompt', @node.prompt ].join(' ') +        end        end        connected?      end diff --git a/lib/oxidized/input/telnet.rb b/lib/oxidized/input/telnet.rb index 62f361e..13fccf7 100644 --- a/lib/oxidized/input/telnet.rb +++ b/lib/oxidized/input/telnet.rb @@ -20,7 +20,11 @@ module Oxidized        @telnet.puts @node.auth[:username]        expect password        @telnet.puts @node.auth[:password] -      expect @node.prompt +      begin +        expect @node.prompt +      rescue Timeout::Error +        raise PromptUndetect, [ 'unable to detect prompt:', @node.prompt ].join(' ') +      end      end      def connected? | 
