summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorytti <saku@ytti.fi>2018-04-15 16:06:34 +0300
committerGitHub <noreply@github.com>2018-04-15 16:06:34 +0300
commita00f5249af5ef533873c0427659b37f2cc43ebc3 (patch)
tree3fccc1e93334cad14e37b45f0fee8dacc299e53c
parentb445f47af43fbaaf78b5bd83c742b0fba6d5089d (diff)
parent7cd3568c90e2aaeaa17863ba14e2af6c23b08b0c (diff)
Merge pull request #1260 from wk/models-backflip
eliminate inverse methods from models
-rw-r--r--.rubocop_todo.yml15
-rw-r--r--lib/oxidized/model/aosw.rb2
-rw-r--r--lib/oxidized/model/asa.rb2
-rw-r--r--lib/oxidized/model/comware.rb2
-rw-r--r--lib/oxidized/model/firewareos.rb2
-rw-r--r--lib/oxidized/model/powerconnect.rb4
-rw-r--r--lib/oxidized/model/procurve.rb2
-rw-r--r--lib/oxidized/model/routeros.rb2
-rw-r--r--lib/oxidized/model/vrp.rb2
-rw-r--r--lib/oxidized/model/zhoneolt.rb2
10 files changed, 10 insertions, 25 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 3724d84..8011dd6 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -882,21 +882,6 @@ Style/InfiniteLoop:
- 'extra/syslog.rb'
- 'lib/oxidized/core.rb'
-# Offense count: 10
-# Cop supports --auto-correct.
-# Configuration parameters: InverseMethods, InverseBlocks.
-Style/InverseMethods:
- Exclude:
- - 'lib/oxidized/model/aosw.rb'
- - 'lib/oxidized/model/asa.rb'
- - 'lib/oxidized/model/comware.rb'
- - 'lib/oxidized/model/firewareos.rb'
- - 'lib/oxidized/model/powerconnect.rb'
- - 'lib/oxidized/model/procurve.rb'
- - 'lib/oxidized/model/routeros.rb'
- - 'lib/oxidized/model/vrp.rb'
- - 'lib/oxidized/model/zhoneolt.rb'
-
# Offense count: 1
# Cop supports --auto-correct.
Style/LineEndConcatenation:
diff --git a/lib/oxidized/model/aosw.rb b/lib/oxidized/model/aosw.rb
index 71fde2e..3397305 100644
--- a/lib/oxidized/model/aosw.rb
+++ b/lib/oxidized/model/aosw.rb
@@ -40,7 +40,7 @@ class AOSW < Oxidized::Model
end
cmd 'show version' do |cfg|
- cfg = cfg.each_line.select { |line| not line.match /(Switch|AP) uptime/i }
+ cfg = cfg.each_line.reject { |line| line.match /(Switch|AP) uptime/i }
rstrip_cfg comment cfg.join
end
diff --git a/lib/oxidized/model/asa.rb b/lib/oxidized/model/asa.rb
index 9df4206..bea0705 100644
--- a/lib/oxidized/model/asa.rb
+++ b/lib/oxidized/model/asa.rb
@@ -27,7 +27,7 @@ class ASA < Oxidized::Model
cmd 'show version' do |cfg|
# avoid commits due to uptime / ixo-router01 up 2 mins 28 secs / ixo-router01 up 1 days 2 hours
- cfg = cfg.each_line.select { |line| not line.match /(\s+up\s+\d+\s+)|(.*days.*)/ }
+ cfg = cfg.each_line.reject { |line| line.match /(\s+up\s+\d+\s+)|(.*days.*)/ }
cfg = cfg.join
comment cfg
end
diff --git a/lib/oxidized/model/comware.rb b/lib/oxidized/model/comware.rb
index a5b7190..0ba26d5 100644
--- a/lib/oxidized/model/comware.rb
+++ b/lib/oxidized/model/comware.rb
@@ -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
diff --git a/lib/oxidized/model/firewareos.rb b/lib/oxidized/model/firewareos.rb
index 1b3d07c..31770dc 100644
--- a/lib/oxidized/model/firewareos.rb
+++ b/lib/oxidized/model/firewareos.rb
@@ -15,7 +15,7 @@ class FirewareOS < Oxidized::Model
cmd 'show sysinfo' do |cfg|
# avoid commits due to uptime
- cfg = cfg.each_line.select { |line| not line.match /(.*time.*)|(.*memory.*)|(.*cpu.*)/ }
+ cfg = cfg.each_line.reject { |line| line.match /(.*time.*)|(.*memory.*)|(.*cpu.*)/ }
cfg = cfg.join
comment cfg
end
diff --git a/lib/oxidized/model/powerconnect.rb b/lib/oxidized/model/powerconnect.rb
index f602a36..ca91e60 100644
--- a/lib/oxidized/model/powerconnect.rb
+++ b/lib/oxidized/model/powerconnect.rb
@@ -22,7 +22,7 @@ class PowerConnect < Oxidized::Model
if (@stackable.nil?)
@stackable = true if cfg.match /(U|u)nit\s/
end
- cfg = cfg.split("\n").select { |line| not line[/Up\sTime/] }
+ cfg = cfg.split("\n").reject { |line| line[/Up\sTime/] }
comment cfg.join("\n") + "\n"
end
@@ -72,7 +72,7 @@ class PowerConnect < Oxidized::Model
end
out << line.strip
end
- out = out.select { |line| not line[/Up\sTime/] }
+ out = out.reject { |line| line[/Up\sTime/] }
out = comment out.join "\n"
out << "\n"
end
diff --git a/lib/oxidized/model/procurve.rb b/lib/oxidized/model/procurve.rb
index 444fb5b..705a814 100644
--- a/lib/oxidized/model/procurve.rb
+++ b/lib/oxidized/model/procurve.rb
@@ -67,7 +67,7 @@ class Procurve < Oxidized::Model
# not supported on all models
cmd 'show system information' do |cfg|
- cfg = cfg.each_line.select { |line| not line.match /(.*CPU.*)|(.*Up Time.*)|(.*Total.*)|(.*Free.*)|(.*Lowest.*)|(.*Missed.*)/ }
+ cfg = cfg.each_line.reject { |line| line.match /(.*CPU.*)|(.*Up Time.*)|(.*Total.*)|(.*Free.*)|(.*Lowest.*)|(.*Missed.*)/ }
cfg = cfg.join
comment cfg
end
diff --git a/lib/oxidized/model/routeros.rb b/lib/oxidized/model/routeros.rb
index 6717446..b62a3be 100644
--- a/lib/oxidized/model/routeros.rb
+++ b/lib/oxidized/model/routeros.rb
@@ -20,7 +20,7 @@ class RouterOS < Oxidized::Model
cfg.gsub! /\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]/, '' # strip ANSI colours
cfg.gsub! /\\\r\n\s+/, '' # strip new line
cfg.gsub! /# inactive time\r\n/, '' # Remove time based system comment
- cfg = cfg.split("\n").select { |line| not line[/^\#\s\w{3}\/\d{2}\/\d{4}.*$/] }
+ cfg = cfg.split("\n").reject { |line| line[/^\#\s\w{3}\/\d{2}\/\d{4}.*$/] }
cfg.join("\n") + "\n"
end
end
diff --git a/lib/oxidized/model/vrp.rb b/lib/oxidized/model/vrp.rb
index 98229c3..e44f69e 100644
--- a/lib/oxidized/model/vrp.rb
+++ b/lib/oxidized/model/vrp.rb
@@ -25,7 +25,7 @@ class VRP < Oxidized::Model
end
cmd 'display version' do |cfg|
- cfg = cfg.each_line.select {|l| not l.match /uptime/ }.join
+ cfg = cfg.each_line.reject { |l| l.match /uptime/ }.join
comment cfg
end
diff --git a/lib/oxidized/model/zhoneolt.rb b/lib/oxidized/model/zhoneolt.rb
index b60edb2..c50680c 100644
--- a/lib/oxidized/model/zhoneolt.rb
+++ b/lib/oxidized/model/zhoneolt.rb
@@ -39,7 +39,7 @@ class ZhoneOLT < Oxidized::Model
end
cmd 'dump console' do |cfg|
- cfg = cfg.each_line.select { |line| not line.match /To Abort the operation enter Ctrl-C/ }.join
+ cfg = cfg.each_line.reject { |line| line.match /To Abort the operation enter Ctrl-C/ }.join
end
# zhone technically supports ssh, but it locks up a ton. Especially when