diff options
author | ytti <saku@ytti.fi> | 2016-12-07 19:57:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-07 19:57:31 +0200 |
commit | 005d1c7ebce5f9a6b38a54d7d7bb3b36f0f8476b (patch) | |
tree | 4435bdf11722e80bc38c7ba72128aa9e28c248b1 /lib/oxidized/model/aosw.rb | |
parent | 8243bf57005758e976025dbe59c12ecf4b21dafe (diff) | |
parent | 47e876c134da3b4f067fcd742fe8ea369b4b4747 (diff) |
Merge pull request #634 from thanegill/master
[AOWS] Remove trailing whitespace and enable prompt detection
Diffstat (limited to 'lib/oxidized/model/aosw.rb')
-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| |