diff options
author | ytti <saku@ytti.fi> | 2015-10-04 00:11:46 +0300 |
---|---|---|
committer | ytti <saku@ytti.fi> | 2015-10-04 00:11:46 +0300 |
commit | 8a5cf58297caabb2335dde98adf9f7307432b92e (patch) | |
tree | c463ccc355c1a9d92e41c04b6a5686eb3cbead19 /lib | |
parent | de2b65627e4ba6151ef6bac9c6770b06e80909c7 (diff) | |
parent | cf591a992c23e2c29f44f50990d6bbcd938015cb (diff) |
Merge pull request #212 from nickhilliard/bf-fix-ironware-arbitrary-nl2
occasionally ironware randomly inserts extraneous blank lines
Diffstat (limited to 'lib')
-rw-r--r-- | lib/oxidized/model/ironware.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/oxidized/model/ironware.rb b/lib/oxidized/model/ironware.rb index 2975651..87a51a6 100644 --- a/lib/oxidized/model/ironware.rb +++ b/lib/oxidized/model/ironware.rb @@ -16,7 +16,9 @@ class IronWare < Oxidized::Model #end cmd :all do |cfg| - cfg.each_line.to_a[1..-2].join + # sometimes ironware inserts arbitrary whitespace after commands are + # issued on the CLI, from run to run. this normalises the output. + cfg.each_line.to_a[1..-2].drop_while { |e| e.match /^\s+$/ }.join end cmd 'show version' do |cfg| @@ -56,7 +58,7 @@ class IronWare < Oxidized::Model cmd 'show running-config' do |cfg| arr = cfg.each_line.to_a - arr[3..-1].join unless arr.length < 3 + arr[2..-1].join unless arr.length < 2 end cfg :telnet do |