From 02b3b8fca75861880f6b1205e7169a368b8cf06e Mon Sep 17 00:00:00 2001 From: Nick Hilliard Date: Sat, 26 Sep 2015 19:10:10 +0100 Subject: fix white space and CR problems on xos model --- lib/oxidized/model/xos.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/oxidized/model/xos.rb b/lib/oxidized/model/xos.rb index 309340f..e4a1ed4 100644 --- a/lib/oxidized/model/xos.rb +++ b/lib/oxidized/model/xos.rb @@ -6,7 +6,9 @@ class XOS < Oxidized::Model comment '# ' cmd :all do |cfg| - cfg.each_line.to_a[1..-2].join + # xos inserts leading \r characters and other trailing white space. + # this deletes extraneous \r and trailing white space. + cfg.each_line.to_a[1..-2].map{|line|line.delete("\r").rstrip}.join("\n") + "\n" end cmd 'show version' do |cfg| -- cgit v1.2.1 From 31054ca0e17ffa5bd7a169cc04d00480e7ce64e6 Mon Sep 17 00:00:00 2001 From: Nick Hilliard Date: Sat, 26 Sep 2015 22:53:37 +0100 Subject: put "show run" at the bottom of oxidized output --- lib/oxidized/model/ironware.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/oxidized/model/ironware.rb b/lib/oxidized/model/ironware.rb index 805e07b..d248e1a 100644 --- a/lib/oxidized/model/ironware.rb +++ b/lib/oxidized/model/ironware.rb @@ -19,11 +19,6 @@ class IronWare < Oxidized::Model cfg.each_line.to_a[1..-2].join end - cmd 'show running-config' do |cfg| - cfg = cfg.each_line.to_a[3..-1].join - cfg - end - cmd 'show version' do |cfg| cfg.gsub! /(^((.*)[Ss]ystem uptime(.*))$)/, '' #remove unwanted line system uptime cfg.gsub! /[Uu]p\s?[Tt]ime is .*/,'' @@ -58,6 +53,11 @@ class IronWare < Oxidized::Model comment cfg end + cmd 'show running-config' do |cfg| + cfg = cfg.each_line.to_a[3..-1].join + cfg + end + cfg :telnet do username /^Username:/ password /^Password:/ -- cgit v1.2.1 From b39e3ff9bf9cf53a82671c06df0e814078c69035 Mon Sep 17 00:00:00 2001 From: Nick Hilliard Date: Sat, 26 Sep 2015 23:00:36 +0100 Subject: some ironware devices are fixed config => no modules --- lib/oxidized/model/ironware.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/oxidized/model/ironware.rb b/lib/oxidized/model/ironware.rb index 805e07b..f0c187b 100644 --- a/lib/oxidized/model/ironware.rb +++ b/lib/oxidized/model/ironware.rb @@ -55,6 +55,7 @@ class IronWare < Oxidized::Model end cmd 'show module' do |cfg| + cfg.gsub! /^((Invalid input)|(Type \?)).*$/, '' # some ironware devices are fixed config comment cfg end -- cgit v1.2.1 From ea8afd886d0ace6acc7debc3b782314cbf0f9ef1 Mon Sep 17 00:00:00 2001 From: Nick Hilliard Date: Sat, 26 Sep 2015 23:11:38 +0100 Subject: move "show inventory" up to stop "show run" from being sandwiched in between comments --- lib/oxidized/model/asa.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/oxidized/model/asa.rb b/lib/oxidized/model/asa.rb index d257e9e..547afd7 100644 --- a/lib/oxidized/model/asa.rb +++ b/lib/oxidized/model/asa.rb @@ -23,16 +23,16 @@ class ASA < Oxidized::Model comment cfg end + cmd 'show inventory' do |cfg| + comment cfg + end + cmd 'more system:running-config' do |cfg| cfg = cfg.each_line.to_a[3..-1].join cfg.gsub! /^: [^\n]*\n/, '' cfg end - cmd 'show inventory' do |cfg| - comment cfg - end - cfg :ssh do if vars :enable post_login do -- cgit v1.2.1