summaryrefslogtreecommitdiff
path: root/lib/oxidized/model
diff options
context:
space:
mode:
authorNick Hilliard <nick@foobar.org>2015-10-03 22:04:31 +0100
committerNick Hilliard <nick@foobar.org>2015-10-03 22:04:31 +0100
commitcf591a992c23e2c29f44f50990d6bbcd938015cb (patch)
treec463ccc355c1a9d92e41c04b6a5686eb3cbead19 /lib/oxidized/model
parentde2b65627e4ba6151ef6bac9c6770b06e80909c7 (diff)
occasionally ironware randomly inserts extraneous blank lines
Diffstat (limited to 'lib/oxidized/model')
-rw-r--r--lib/oxidized/model/ironware.rb6
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