diff options
| author | Thane Gill <me@thanegill.com> | 2016-12-07 08:17:44 -0800 | 
|---|---|---|
| committer | Thane Gill <me@thanegill.com> | 2016-12-07 08:22:37 -0800 | 
| commit | 47e876c134da3b4f067fcd742fe8ea369b4b4747 (patch) | |
| tree | 4435bdf11722e80bc38c7ba72128aa9e28c248b1 /lib/oxidized | |
| parent | 8243bf57005758e976025dbe59c12ecf4b21dafe (diff) | |
Remove trailing whitespace and enable prompt detection
Fixes: #630
Diffstat (limited to 'lib/oxidized')
| -rw-r--r-- | lib/oxidized/model/aosw.rb | 21 | 
1 files changed, 16 insertions, 5 deletions
| diff --git a/lib/oxidized/model/aosw.rb b/lib/oxidized/model/aosw.rb index d533727..11d8442 100644 --- a/lib/oxidized/model/aosw.rb +++ b/lib/oxidized/model/aosw.rb @@ -28,19 +28,21 @@ class AOSW < Oxidized::Model    cmd 'show version' do |cfg|      cfg = cfg.each_line.select { |line| not line.match /Switch uptime/i } -    comment cfg.join +    rstrip_cfg comment cfg.join    end    cmd 'show inventory' do |cfg| -    clean cfg +    rstrip_cfg clean cfg    end    cmd 'show slots' do |cfg| -    comment cfg +    rstrip_cfg comment cfg    end +    cmd 'show license' do |cfg| -    comment cfg +    rstrip_cfg comment cfg    end +    cmd 'show running-config' do |cfg|      out = []      cfg.each_line do |line| @@ -61,7 +63,7 @@ class AOSW < Oxidized::Model      if vars :enable        post_login do          send "enable\n" -        send vars(:enable) + "\n" +        cmd vars(:enable)        end      end      post_login 'no paging' @@ -72,6 +74,15 @@ class AOSW < Oxidized::Model      pre_logout 'exit'    end +  def rstrip_cfg cfg +    out = [] +    cfg.each_line do |line| +      out << line.rstrip +    end +    out = out.join "\n" +    out << "\n" +  end +    def clean cfg      out = []      cfg.each_line do |line| | 
