From 17a9fb3d013912eea2a1e834bc0480b677592d71 Mon Sep 17 00:00:00 2001 From: Samer Abdel-Hafez Date: Wed, 1 May 2013 12:45:11 +0100 Subject: add latest changes --- lib/oxidized/input/ssh.rb | 2 +- lib/oxidized/input/telnet.rb | 4 ++-- lib/oxidized/model/ios.rb | 4 ++-- lib/oxidized/model/powerconnect.rb | 9 ++++----- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/oxidized/input/ssh.rb b/lib/oxidized/input/ssh.rb index 3d14a57..430eaa2 100644 --- a/lib/oxidized/input/ssh.rb +++ b/lib/oxidized/input/ssh.rb @@ -12,7 +12,7 @@ module Oxidized begin @ssh = Net::SSH.start @node.ip, @node.auth[:username], :password => @node.auth[:password], :timeout => CFG.timeout - rescue Timeout::Error, Net::SSH::Disconnect, Errno::ECONNREFUSED + rescue Timeout::Error, Errno::ECONNREFUSED, Errno::ECONNRESET, Net::SSH::Disconnect return false end open_shell @ssh unless @exec diff --git a/lib/oxidized/input/telnet.rb b/lib/oxidized/input/telnet.rb index c1afde2..f1222d8 100644 --- a/lib/oxidized/input/telnet.rb +++ b/lib/oxidized/input/telnet.rb @@ -17,7 +17,7 @@ module Oxidized expect password @telnet.puts @node.auth[:password] expect @node.prompt - rescue Errno::ECONNREFUSED, Timeout::Error + rescue Timeout::Error, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EHOSTUNREACH return false end end @@ -28,7 +28,7 @@ module Oxidized args.merge!({ 'Match' => expect, 'Timeout' => @timeout }) if expect begin @telnet.cmd args - rescue Timeout::Error, Errno::ECONNRESET + rescue Timeout::Error, Errno::ECONNRESET, Errno::EPIPE return false end end diff --git a/lib/oxidized/model/ios.rb b/lib/oxidized/model/ios.rb index 7da5ed2..3fcc7ae 100644 --- a/lib/oxidized/model/ios.rb +++ b/lib/oxidized/model/ios.rb @@ -11,7 +11,7 @@ class IOS < Oxidized::Model # non-preferred way to handle additional PW prompt #expect /^[\w.]+>$/ do |data| # send "enable\n" - # send CFG.passwords[:enable] + "\n" + # send CFG.vars[:enable] + "\n" # data #end @@ -42,7 +42,7 @@ class IOS < Oxidized::Model # preferred way to handle additional passwords #post_login do # send "enable\n" - # send CFG.passwords[:enable] + "\n" + # send CFG.vars[:enable] + "\n" #end pre_logout 'exit' end diff --git a/lib/oxidized/model/powerconnect.rb b/lib/oxidized/model/powerconnect.rb index 732245e..0dbd808 100644 --- a/lib/oxidized/model/powerconnect.rb +++ b/lib/oxidized/model/powerconnect.rb @@ -1,15 +1,14 @@ class PowerConnect < Oxidized::Model + prompt /^([\w\s.@-]+[#>]\s?)$/ # allow spaces in hostname..dell does not limit it.. # + comment '! ' cmd :all do |cfg| cfg.each_line.to_a[1..-3].join end - cmd 'show running-config' do |cfg| - cfg = cfg.each_line.to_a[3..-1].join - cfg - end + cmd 'show running-config' cmd 'show version' do |cfg| comment cfg @@ -20,7 +19,7 @@ class PowerConnect < Oxidized::Model end cfg :telnet do - username /^User Name:/ + username /^User( Name)?:/ password /^\r?Password:/ end -- cgit v1.2.1