diff options
author | ytti <saku@ytti.fi> | 2015-09-28 11:15:48 -0500 |
---|---|---|
committer | ytti <saku@ytti.fi> | 2015-09-28 11:15:48 -0500 |
commit | 6599bff3fac0df18b1af30d52459bd9e931ee06f (patch) | |
tree | f29fd00148a1230d88b2d6374559eecada574a9b /lib/oxidized | |
parent | 684882386416ff7ee1036243e2986f993910bfa5 (diff) | |
parent | dbaa0aa77d4420f660262222cbcf99fa3e3cbf4e (diff) |
Merge pull request #194 from skoef/master
made IronWare compatible with older Foundry/Brocade switches
Diffstat (limited to 'lib/oxidized')
-rw-r--r-- | lib/oxidized/model/ironware.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/oxidized/model/ironware.rb b/lib/oxidized/model/ironware.rb index c7fbeee..2975651 100644 --- a/lib/oxidized/model/ironware.rb +++ b/lib/oxidized/model/ironware.rb @@ -31,7 +31,7 @@ class IronWare < Oxidized::Model cfg.gsub! /(^((.*)Current temp(.*))$)/, '' #remove unwanted lines current temperature cfg.gsub! /Speed = [A-Z]{3} \(\d{2}\%\)/, '' #remove unwanted lines Speed Fans cfg.gsub! /current speed is [A-Z]{3} \(\d{2}\%\)/, '' - cfg.gsub! /Fan controlled temperature: \d{2}\.\d deg-C/, 'Fan controlled temperature: XX.X d deg-C' + cfg.gsub! /\d{2}\.\d deg-C/, 'XX.X deg-C' if cfg.include? "TEMPERATURE" sc = StringScanner.new cfg out = '' @@ -55,21 +55,23 @@ class IronWare < Oxidized::Model end cmd 'show running-config' do |cfg| - cfg = cfg.each_line.to_a[3..-1].join - cfg + arr = cfg.each_line.to_a + arr[3..-1].join unless arr.length < 3 end cfg :telnet do - username /^Username:/ - password /^Password:/ + # match expected prompts on both older and newer + # versions of IronWare + username /^(Please Enter Login Name|Username):/ + password /^(Please Enter )Password:/ end #handle pager with enable cfg :telnet, :ssh do if vars :enable post_login do - send "enable\n" - send vars(:enable) + "\n" + send "enable\r\n" + send vars(:enable) + "\r\n" end end post_login '' @@ -80,4 +82,4 @@ class IronWare < Oxidized::Model pre_logout 'exit' end -end
\ No newline at end of file +end |