diff options
author | Neil Lathwood <neil@lathwood.co.uk> | 2018-04-27 10:51:39 +0100 |
---|---|---|
committer | Neil Lathwood <neil@lathwood.co.uk> | 2018-04-27 10:51:39 +0100 |
commit | 6574f129bca9633d728c178b12e49a2e9be89cdd (patch) | |
tree | a2d630fca3156658aea07469b9a5c3fdf00f6846 /lib/oxidized/model/comware.rb | |
parent | d96cfac1f09ff4055f54ab604358290865d41f62 (diff) | |
parent | 34fd5369feee94ab45c5a81d7769b1df717e4c8c (diff) |
Rebased from master
Diffstat (limited to 'lib/oxidized/model/comware.rb')
-rw-r--r-- | lib/oxidized/model/comware.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/oxidized/model/comware.rb b/lib/oxidized/model/comware.rb index d926854..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 - prompt /^\0*(<[\w.-]+>)$/ + + # 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 <configuration removed>' cfg.gsub! /^( password hash).*/, '\\1 <configuration removed>' @@ -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 |