lib/oxidized/model/aosw.rb in oxidized-0.18.0 vs lib/oxidized/model/aosw.rb in oxidized-0.19.0

- old
+ new

@@ -26,23 +26,25 @@ cfg end 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| next if line.match /^controller config \d+$/ next if line.match /^Building Configuration/ @@ -59,18 +61,27 @@ cfg :telnet, :ssh do if vars :enable post_login do send "enable\n" - send vars(:enable) + "\n" + cmd vars(:enable) end end post_login 'no paging' post_login 'encrypt disable' if vars :enable pre_logout 'exit' end 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|