lib/oxidized/model/aosw.rb in oxidized-0.25.1 vs lib/oxidized/model/aosw.rb in oxidized-0.26.0
- old
+ new
@@ -42,29 +42,29 @@
cfg = cfg.each_line.reject { |line| line.match /(Switch|AP) uptime/i }
rstrip_cfg comment cfg.join
end
cmd 'show inventory' do |cfg|
- cfg = "" if cfg.match /(Invalid input detected at '\^' marker|Parse error)/ # Don't show for unsupported devices (IAP and MAS)
+ cfg = "" if cfg =~ /(Invalid input detected at '\^' marker|Parse error)/ # Don't show for unsupported devices (IAP and MAS)
rstrip_cfg clean cfg
end
cmd 'show slots' do |cfg|
- cfg = "" if cfg.match /(Invalid input detected at '\^' marker|Parse error)/ # Don't show for unsupported devices (IAP and MAS)
+ cfg = "" if cfg =~ /(Invalid input detected at '\^' marker|Parse error)/ # Don't show for unsupported devices (IAP and MAS)
rstrip_cfg comment cfg
end
cmd 'show license' do |cfg|
- cfg = "" if cfg.match /(Invalid input detected at '\^' marker|Parse error)/ # Don't show for unsupported devices (IAP and MAS)
+ cfg = "" if cfg =~ /(Invalid input detected at '\^' marker|Parse error)/ # Don't show for unsupported devices (IAP and MAS)
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/
+ next if line =~ /^controller config \d+$/
+ next if line =~ /^Building Configuration/
out << line.strip
end
out = out.join "\n"
out << "\n"
@@ -82,32 +82,30 @@
cmd vars(:enable)
end
end
post_login 'no paging'
post_login 'encrypt disable'
- if vars :enable
- pre_logout 'exit'
- end
+ pre_logout 'exit' if vars :enable
pre_logout 'exit'
end
- def rstrip_cfg cfg
+ def rstrip_cfg(cfg)
out = []
cfg.each_line do |line|
out << line.rstrip
end
out = out.join "\n"
out << "\n"
end
- def clean cfg
+ def clean(cfg)
out = []
cfg.each_line do |line|
# drop the temperature, fan speed and voltage, which change each run
- next if line.match /Output \d Config/i
- next if line.match /(Tachometers|Temperatures|Voltages)/
- next if line.match /((Card|CPU) Temperature|Chassis Fan|VMON1[0-9])/
- next if line.match /[0-9]+\s+(RPMS?|m?V|C)/i
+ next if line =~ /Output \d Config/i
+ next if line =~ /(Tachometers|Temperatures|Voltages)/
+ next if line =~ /((Card|CPU) Temperature|Chassis Fan|VMON1[0-9])/
+ next if line =~ /[0-9]+\s+(RPMS?|m?V|C)/i
out << line.strip
end
out = comment out.join "\n"
out << "\n"