From a4bd3e5ca5ab747fdbf2bd876d7be7a947e74f46 Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Sun, 8 Apr 2018 00:35:47 +0200 Subject: eliminate inverse methods from models --- lib/oxidized/model/comware.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/oxidized/model/comware.rb') diff --git a/lib/oxidized/model/comware.rb b/lib/oxidized/model/comware.rb index a5b7190..0ba26d5 100644 --- a/lib/oxidized/model/comware.rb +++ b/lib/oxidized/model/comware.rb @@ -47,7 +47,7 @@ class Comware < Oxidized::Model end cmd 'display version' do |cfg| - cfg = cfg.each_line.select {|l| not l.match /uptime/i }.join + cfg = cfg.each_line.reject { |l| l.match /uptime/i }.join comment cfg end -- cgit v1.2.1 From 21e3d6490496573f25ef77fe8172766ac7d1a736 Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Sat, 21 Apr 2018 13:27:05 +0200 Subject: the great makeover - standardize layout, alignment, indentation --- lib/oxidized/model/comware.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/oxidized/model/comware.rb') diff --git a/lib/oxidized/model/comware.rb b/lib/oxidized/model/comware.rb index 0ba26d5..f20cd4d 100644 --- a/lib/oxidized/model/comware.rb +++ b/lib/oxidized/model/comware.rb @@ -1,23 +1,23 @@ class Comware < Oxidized::Model # HP (A-series)/H3C/3Com Comware - + # sometimes the prompt might have a leading nul or trailing ASCII Bell (^G) prompt /^\0*(<[\w.-]+>).?$/ comment '# ' # example how to handle pager - #expect /^\s*---- More ----$/ do |data, re| + # expect /^\s*---- More ----$/ do |data, re| # send ' ' # data.sub re, '' - #end + # end cmd :all do |cfg| - #cfg.gsub! /^.*\e\[42D/, '' # example how to handle pager - #skip rogue ^M + # cfg.gsub! /^.*\e\[42D/, '' # example how to handle pager + # skip rogue ^M cfg = cfg.gsub /\r/, '' cfg.each_line.to_a[1..-2].join end - + cmd :secret do |cfg| cfg.gsub! /^( snmp-agent community).*/, '\\1 ' cfg.gsub! /^( password hash).*/, '\\1 ' -- cgit v1.2.1