summaryrefslogtreecommitdiff
path: root/lib/oxidized/input/ssh.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oxidized/input/ssh.rb')
-rw-r--r--lib/oxidized/input/ssh.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/oxidized/input/ssh.rb b/lib/oxidized/input/ssh.rb
index dc90354..b060418 100644
--- a/lib/oxidized/input/ssh.rb
+++ b/lib/oxidized/input/ssh.rb
@@ -2,6 +2,10 @@ module Oxidized
require 'net/ssh'
require 'oxidized/input/cli'
class SSH < Input
+ RescueFail = [
+ Net::SSH::Disconnect,
+ Net::SSH::AuthenticationFailed,
+ ]
include CLI
class NoShell < StandardError; end
@@ -9,14 +13,12 @@ module Oxidized
@node = node
@output = ''
@node.model.cfg['ssh'].each { |cb| instance_exec &cb }
- begin
- @ssh = Net::SSH.start @node.ip, @node.auth[:username],
- :password => @node.auth[:password], :timeout => CFG.timeout
- rescue Timeout::Error, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EHOSTUNREACH, Net::SSH::Disconnect
- return false
- end
+ secure = CFG.input[:ssh][:secure]
+ @ssh = Net::SSH.start @node.ip, @node.auth[:username],
+ :password => @node.auth[:password], :timeout => CFG.timeout,
+ :paranoid => secure
open_shell @ssh unless @exec
- not @ssh.closed?
+ @ssh and not @ssh.closed?
end
def cmd cmd, expect=@node.prompt