From cf591a992c23e2c29f44f50990d6bbcd938015cb Mon Sep 17 00:00:00 2001 From: Nick Hilliard Date: Sat, 3 Oct 2015 22:04:31 +0100 Subject: occasionally ironware randomly inserts extraneous blank lines --- lib/oxidized/model/ironware.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/oxidized/model') 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 -- cgit v1.2.1