oxidized 0.25.1 → 0.26.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +30 -9
  3. data/.rubocop_todo.yml +16 -637
  4. data/.travis.yml +2 -3
  5. data/CHANGELOG.md +14 -0
  6. data/Dockerfile +7 -5
  7. data/README.md +18 -14
  8. data/Rakefile +2 -2
  9. data/bin/console +1 -1
  10. data/bin/oxidized +2 -2
  11. data/docs/Configuration.md +6 -0
  12. data/docs/Model-Notes/README.md +1 -0
  13. data/docs/Model-Notes/SmartAX-Huawei.md +35 -0
  14. data/docs/Supported-OS-Types.md +12 -0
  15. data/extra/nagios_check_failing_nodes.rb +1 -1
  16. data/extra/rest_client.rb +6 -8
  17. data/extra/syslog.rb +33 -33
  18. data/lib/oxidized/cli.rb +25 -26
  19. data/lib/oxidized/config.rb +9 -9
  20. data/lib/oxidized/config/vars.rb +3 -7
  21. data/lib/oxidized/core.rb +4 -7
  22. data/lib/oxidized/hook.rb +16 -17
  23. data/lib/oxidized/hook/awssns.rb +4 -4
  24. data/lib/oxidized/hook/exec.rb +16 -20
  25. data/lib/oxidized/hook/githubrepo.rb +8 -14
  26. data/lib/oxidized/hook/noophook.rb +1 -1
  27. data/lib/oxidized/hook/xmppdiff.rb +1 -1
  28. data/lib/oxidized/input/cli.rb +12 -12
  29. data/lib/oxidized/input/ftp.rb +8 -8
  30. data/lib/oxidized/input/http.rb +37 -14
  31. data/lib/oxidized/input/input.rb +6 -6
  32. data/lib/oxidized/input/ssh.rb +31 -31
  33. data/lib/oxidized/input/telnet.rb +24 -24
  34. data/lib/oxidized/input/tftp.rb +9 -10
  35. data/lib/oxidized/jobs.rb +7 -7
  36. data/lib/oxidized/manager.rb +13 -13
  37. data/lib/oxidized/model/acos.rb +2 -2
  38. data/lib/oxidized/model/aireos.rb +3 -3
  39. data/lib/oxidized/model/aos7.rb +1 -1
  40. data/lib/oxidized/model/aosw.rb +12 -14
  41. data/lib/oxidized/model/apc_aos.rb +1 -1
  42. data/lib/oxidized/model/aricentiss.rb +6 -8
  43. data/lib/oxidized/model/asa.rb +1 -1
  44. data/lib/oxidized/model/audiocodesmp.rb +28 -0
  45. data/lib/oxidized/model/awplus.rb +9 -9
  46. data/lib/oxidized/model/boss.rb +1 -1
  47. data/lib/oxidized/model/ciscosmb.rb +1 -1
  48. data/lib/oxidized/model/ciscovpn3k.rb +11 -0
  49. data/lib/oxidized/model/comware.rb +1 -1
  50. data/lib/oxidized/model/cumulus.rb +3 -1
  51. data/lib/oxidized/model/dellx.rb +5 -5
  52. data/lib/oxidized/model/edgeos.rb +1 -1
  53. data/lib/oxidized/model/edgeswitch.rb +1 -1
  54. data/lib/oxidized/model/fabricos.rb +1 -1
  55. data/lib/oxidized/model/fortios.rb +5 -5
  56. data/lib/oxidized/model/ftos.rb +1 -1
  57. data/lib/oxidized/model/gcombnps.rb +7 -7
  58. data/lib/oxidized/model/grandstream.rb +9 -0
  59. data/lib/oxidized/model/hatteras.rb +8 -8
  60. data/lib/oxidized/model/ios.rb +22 -40
  61. data/lib/oxidized/model/ironware.rb +1 -1
  62. data/lib/oxidized/model/junos.rb +1 -1
  63. data/lib/oxidized/model/mlnxos.rb +1 -1
  64. data/lib/oxidized/model/model.rb +32 -38
  65. data/lib/oxidized/model/netgearxs716.rb +23 -0
  66. data/lib/oxidized/model/netonix.rb +1 -1
  67. data/lib/oxidized/model/netscaler.rb +1 -1
  68. data/lib/oxidized/model/nos.rb +2 -2
  69. data/lib/oxidized/model/nxos.rb +1 -1
  70. data/lib/oxidized/model/openbsd.rb +3 -2
  71. data/lib/oxidized/model/outputs.rb +4 -4
  72. data/lib/oxidized/model/planet.rb +4 -4
  73. data/lib/oxidized/model/powerconnect.rb +8 -8
  74. data/lib/oxidized/model/procurve.rb +2 -1
  75. data/lib/oxidized/model/quantaos.rb +3 -3
  76. data/lib/oxidized/model/raisecom.rb +19 -0
  77. data/lib/oxidized/model/siklu.rb +1 -1
  78. data/lib/oxidized/model/slxos.rb +1 -1
  79. data/lib/oxidized/model/smartax.rb +25 -0
  80. data/lib/oxidized/model/sros.rb +4 -4
  81. data/lib/oxidized/model/tdre.rb +30 -0
  82. data/lib/oxidized/model/tmos.rb +3 -0
  83. data/lib/oxidized/model/trango.rb +17 -37
  84. data/lib/oxidized/model/voltaire.rb +1 -1
  85. data/lib/oxidized/model/voss.rb +1 -1
  86. data/lib/oxidized/model/vyatta.rb +1 -1
  87. data/lib/oxidized/model/xos.rb +1 -1
  88. data/lib/oxidized/model/zhoneolt.rb +1 -1
  89. data/lib/oxidized/node.rb +42 -46
  90. data/lib/oxidized/node/stats.rb +6 -6
  91. data/lib/oxidized/nodes.rb +42 -42
  92. data/lib/oxidized/output/file.rb +16 -20
  93. data/lib/oxidized/output/git.rb +68 -78
  94. data/lib/oxidized/output/gitcrypt.rb +77 -91
  95. data/lib/oxidized/output/http.rb +17 -19
  96. data/lib/oxidized/output/output.rb +1 -1
  97. data/lib/oxidized/source/csv.rb +3 -3
  98. data/lib/oxidized/source/http.rb +11 -14
  99. data/lib/oxidized/source/source.rb +3 -3
  100. data/lib/oxidized/source/sql.rb +16 -18
  101. data/lib/oxidized/string.rb +10 -10
  102. data/lib/oxidized/version.rb +4 -4
  103. data/lib/oxidized/worker.rb +15 -15
  104. data/oxidized.gemspec +6 -9
  105. metadata +32 -25
@@ -5,13 +5,13 @@ module Oxidized
5
5
  require 'oxidized/source/source'
6
6
  class Manager
7
7
  class << self
8
- def load dir, file
8
+ def load(dir, file)
9
9
  require File.join dir, file + '.rb'
10
10
  klass = nil
11
11
  [Oxidized, Object].each do |mod|
12
- klass = mod.constants.find { |const| const.to_s.downcase == file.downcase }
13
- klass = mod.constants.find { |const| const.to_s.downcase == 'oxidized' + file.downcase } unless klass
14
- klass = mod.const_get klass if klass
12
+ klass = mod.constants.find { |const| const.to_s.casecmp(file).zero? }
13
+ klass ||= mod.constants.find { |const| const.to_s.downcase == 'oxidized' + file.downcase }
14
+ klass = mod.const_get klass if klass
15
15
  break if klass
16
16
  end
17
17
  i = klass.new
@@ -31,33 +31,33 @@ module Oxidized
31
31
  @hook = {}
32
32
  end
33
33
 
34
- def add_input name
34
+ def add_input(name)
35
35
  loader @input, Config::InputDir, "input", name
36
36
  end
37
37
 
38
- def add_output name
38
+ def add_output(name)
39
39
  loader @output, Config::OutputDir, "output", name
40
40
  end
41
41
 
42
- def add_source name
42
+ def add_source(name)
43
43
  loader @source, Config::SourceDir, "source", name
44
44
  end
45
45
 
46
- def add_model name
46
+ def add_model(name)
47
47
  loader @model, Config::ModelDir, "model", name
48
48
  end
49
49
 
50
- def add_hook name
50
+ def add_hook(name)
51
51
  loader @hook, Config::HookDir, "hook", name
52
52
  end
53
53
 
54
54
  private
55
55
 
56
56
  # if local version of file exists, load it, else load global - return falsy value if nothing loaded
57
- def loader hash, global_dir, local_dir, name
58
- dir = File.join(Config::Root, local_dir)
59
- map = Manager.load(dir, name) if File.exist? File.join(dir, name + ".rb")
60
- map = Manager.load(global_dir, name) unless map
57
+ def loader(hash, global_dir, local_dir, name)
58
+ dir = File.join(Config::Root, local_dir)
59
+ map = Manager.load(dir, name) if File.exist? File.join(dir, name + ".rb")
60
+ map ||= Manager.load(global_dir, name)
61
61
  hash.merge!(map) if map
62
62
  end
63
63
  end
@@ -51,9 +51,9 @@ class ACOS < Oxidized::Model
51
51
 
52
52
  cmd 'show aflex all-partitions' do |cfg|
53
53
  @partitions_aflex = cfg.lines.each_with_object({}) do |l, h|
54
- h[$1] = [] if l.match /partition: (.+)/
54
+ h[Regexp.last_match(1)] = [] if l =~ /partition: (.+)/
55
55
  # only consider scripts that have passed syntax check
56
- h[h.keys.last] << $1 if l.match /^([\w-]+) +Check/
56
+ h[h.keys.last] << Regexp.last_match(1) if l =~ /^([\w-]+) +Check/
57
57
  end
58
58
  ''
59
59
  end
@@ -39,11 +39,11 @@ class Aireos < Oxidized::Model
39
39
  end
40
40
  end
41
41
 
42
- def clean cfg
42
+ def clean(cfg)
43
43
  out = []
44
44
  cfg.each_line do |line|
45
- next if line.match /^\s*$/
46
- next if line.match /rogue (adhoc|client) (alert|Unknown) [\da-f]{2}:/
45
+ next if line =~ /^\s*$/
46
+ next if line =~ /rogue (adhoc|client) (alert|Unknown) [\da-f]{2}:/
47
47
 
48
48
  line = line[1..-1] if line[0] == "\r"
49
49
  out << line.strip
@@ -17,7 +17,7 @@ class AOS7 < Oxidized::Model
17
17
  cmd 'show chassis' do |cfg|
18
18
  # check for virtual chassis existence
19
19
  @slave_vcids = cfg.scan(/Chassis ID (\d+) \(Slave\)/).flatten
20
- @master_vcid = $1 if cfg.match /Chassis ID (\d+) \(Master\)/
20
+ @master_vcid = Regexp.last_match(1) if cfg =~ /Chassis ID (\d+) \(Master\)/
21
21
  comment cfg
22
22
  end
23
23
 
@@ -44,25 +44,25 @@ class AOSW < Oxidized::Model
44
44
  end
45
45
 
46
46
  cmd 'show inventory' do |cfg|
47
- cfg = "" if cfg.match /(Invalid input detected at '\^' marker|Parse error)/ # Don't show for unsupported devices (IAP and MAS)
47
+ cfg = "" if cfg =~ /(Invalid input detected at '\^' marker|Parse error)/ # Don't show for unsupported devices (IAP and MAS)
48
48
  rstrip_cfg clean cfg
49
49
  end
50
50
 
51
51
  cmd 'show slots' do |cfg|
52
- cfg = "" if cfg.match /(Invalid input detected at '\^' marker|Parse error)/ # Don't show for unsupported devices (IAP and MAS)
52
+ cfg = "" if cfg =~ /(Invalid input detected at '\^' marker|Parse error)/ # Don't show for unsupported devices (IAP and MAS)
53
53
  rstrip_cfg comment cfg
54
54
  end
55
55
 
56
56
  cmd 'show license' do |cfg|
57
- cfg = "" if cfg.match /(Invalid input detected at '\^' marker|Parse error)/ # Don't show for unsupported devices (IAP and MAS)
57
+ cfg = "" if cfg =~ /(Invalid input detected at '\^' marker|Parse error)/ # Don't show for unsupported devices (IAP and MAS)
58
58
  rstrip_cfg comment cfg
59
59
  end
60
60
 
61
61
  cmd 'show running-config' do |cfg|
62
62
  out = []
63
63
  cfg.each_line do |line|
64
- next if line.match /^controller config \d+$/
65
- next if line.match /^Building Configuration/
64
+ next if line =~ /^controller config \d+$/
65
+ next if line =~ /^Building Configuration/
66
66
 
67
67
  out << line.strip
68
68
  end
@@ -84,13 +84,11 @@ class AOSW < Oxidized::Model
84
84
  end
85
85
  post_login 'no paging'
86
86
  post_login 'encrypt disable'
87
- if vars :enable
88
- pre_logout 'exit'
89
- end
87
+ pre_logout 'exit' if vars :enable
90
88
  pre_logout 'exit'
91
89
  end
92
90
 
93
- def rstrip_cfg cfg
91
+ def rstrip_cfg(cfg)
94
92
  out = []
95
93
  cfg.each_line do |line|
96
94
  out << line.rstrip
@@ -99,14 +97,14 @@ class AOSW < Oxidized::Model
99
97
  out << "\n"
100
98
  end
101
99
 
102
- def clean cfg
100
+ def clean(cfg)
103
101
  out = []
104
102
  cfg.each_line do |line|
105
103
  # drop the temperature, fan speed and voltage, which change each run
106
- next if line.match /Output \d Config/i
107
- next if line.match /(Tachometers|Temperatures|Voltages)/
108
- next if line.match /((Card|CPU) Temperature|Chassis Fan|VMON1[0-9])/
109
- next if line.match /[0-9]+\s+(RPMS?|m?V|C)/i
104
+ next if line =~ /Output \d Config/i
105
+ next if line =~ /(Tachometers|Temperatures|Voltages)/
106
+ next if line =~ /((Card|CPU) Temperature|Chassis Fan|VMON1[0-9])/
107
+ next if line =~ /[0-9]+\s+(RPMS?|m?V|C)/i
110
108
 
111
109
  out << line.strip
112
110
  end
@@ -1,4 +1,4 @@
1
- class Apc_aos < Oxidized::Model
1
+ class Apc_aos < Oxidized::Model # rubocop:disable Naming/ClassAndModuleCamelCase
2
2
  cmd 'config.ini' do |cfg|
3
3
  cfg.gsub! /^; Configuration file, generated on.*/, ''
4
4
  end
@@ -4,7 +4,7 @@
4
4
  # 0 SSE-G48-TG4 (P2-01) 1.0.16-9
5
5
 
6
6
  class AricentISS < Oxidized::Model
7
- prompt (/^(\e\[27m)?[ \r]*[\w-]+# ?$/)
7
+ prompt /^(\e\[27m)?[ \r]*[\w-]+# ?$/
8
8
 
9
9
  cfg :ssh do
10
10
  # "pagination" was misspelled in some (earlier) versions (at least 1.0.16-9)
@@ -33,19 +33,17 @@ class AricentISS < Oxidized::Model
33
33
 
34
34
  cmd 'show running-config' do |cfg|
35
35
  comment_next = 0
36
- cfg.each_line.map { |l|
37
- next '' if l.match /^Building configuration/
36
+ cfg.each_line.map do |l|
37
+ next '' if l =~ /^Building configuration/
38
38
 
39
- if l.match /^Switch ID.*Hardware Version.*Firmware Version/ then
40
- comment_next = 2
41
- end
39
+ comment_next = 2 if l =~ /^Switch ID.*Hardware Version.*Firmware Version/
42
40
 
43
- if comment_next > 0 then
41
+ if comment_next.positive?
44
42
  comment_next -= 1
45
43
  next comment(l)
46
44
  end
47
45
 
48
46
  l
49
- }.join.gsub(/ +$/, '')
47
+ end.join.gsub(/ +$/, '')
50
48
  end
51
49
  end
@@ -69,7 +69,7 @@ class ASA < Oxidized::Model
69
69
  anyconnect_profiles = cfg.scan(Regexp.new('(\sdisk0:/.+\.xml)')).flatten
70
70
  anyconnect_profiles.each do |profile|
71
71
  cfg << (comment profile + "\n")
72
- cmd ("more" + profile) do |xml|
72
+ cmd("more" + profile) do |xml|
73
73
  cfg << (comment xml)
74
74
  end
75
75
  end
@@ -0,0 +1,28 @@
1
+ class AudioCodesMP < Oxidized::Model
2
+ # AudioCodes MediaPack MP1xx and Mediant 1000 devices (firmware v4.xx, v5.xx, v6.xx) by pedjajks@gmail.com
3
+
4
+ prompt /^\/\w*>/
5
+
6
+ comment ';'
7
+
8
+ cmd 'conf' do
9
+ end
10
+
11
+ cmd 'cf get' do |cfg|
12
+ lines = cfg.each_line.to_a[0..-1]
13
+ # remove any garbage before ';**************' and after '; End of INI file.'
14
+ lines[lines.index(";**************\r\n")..lines.index("; End of INI file.\n")].join
15
+ end
16
+
17
+ cfg :ssh do
18
+ username /^login as:\s$/
19
+ password /^.+password:\s$/
20
+ pre_logout 'exit'
21
+ end
22
+
23
+ cfg :telnet do
24
+ username /login:\s$/
25
+ password /password:\s$/
26
+ pre_logout 'exit'
27
+ end
28
+ end
@@ -15,7 +15,7 @@ class AWPlus < Oxidized::Model
15
15
  cmd :all do |cfg|
16
16
  cfg.gsub! /\e\[K/, '' # example how to handle pager - cleareol EL0
17
17
  cfg.gsub! /\e\[7m\e\[m/, '' # example how to handle pager - Reverse SGR7
18
- cfg.gsub! /\r/, '' # Filters rogue ^M - see issue #415
18
+ cfg.delete! "\r" # Filters rogue ^M - see issue #415
19
19
  cfg.cut_both
20
20
  end
21
21
 
@@ -43,14 +43,14 @@ class AWPlus < Oxidized::Model
43
43
  comment cfg << "\n--------------------------------------------------------------------------------! \n \n"
44
44
  # Removes the following lines from "show system" in output file. This ensures oxidized diffs are meaningful.
45
45
  comment cfg.each_line.reject { |line|
46
- line.match /^$\n/ or # Remove blank lines in "sh sys"
47
- line.match /System Status\s*.*/ or
48
- line.match /RAM\s*:.*/ or
49
- line.match /Uptime\s*:.*/ or
50
- line.match /Flash\s*:.*/ or
51
- line.match /Current software\s*:.*/ or
52
- line.match /Software version\s*:.*/ or
53
- line.match /Build date\s*:.*/
46
+ line.match(/^$\n/) || # Remove blank lines in "sh sys"
47
+ line.match(/System Status\s*.*/) ||
48
+ line.match(/RAM\s*:.*/) ||
49
+ line.match(/Uptime\s*:.*/) ||
50
+ line.match(/Flash\s*:.*/) ||
51
+ line.match(/Current software\s*:.*/) ||
52
+ line.match(/Software version\s*:.*/) ||
53
+ line.match(/Build date\s*:.*/)
54
54
  } .join
55
55
  end
56
56
 
@@ -37,7 +37,7 @@ class Boss < Oxidized::Model
37
37
 
38
38
  # Do a sys-info and check and see if it supports stack
39
39
  cmd 'show sys-info' do |cfg|
40
- @stack = true if cfg.match /Stack/
40
+ @stack = true if cfg =~ /Stack/
41
41
  cfg.gsub! /(^((.*)sysUpTime(.*))$)/, 'removed sysUpTime'
42
42
  cfg.gsub! /(^((.*)sysNtpTime(.*))$)/, 'removed sysNtpTime'
43
43
  cfg.gsub! /(^((.*)sysRtcTime(.*))$)/, 'removed sysNtpTime'
@@ -8,7 +8,7 @@ class CiscoSMB < Oxidized::Model
8
8
  cmd :all do |cfg|
9
9
  lines = cfg.each_line.to_a[1..-2]
10
10
  # Remove \r from beginning of response
11
- lines[0].gsub!(/^\r.*?/, '') if lines.length > 0
11
+ lines[0].gsub!(/^\r.*?/, '') unless lines.empty?
12
12
  lines.join
13
13
  end
14
14
 
@@ -0,0 +1,11 @@
1
+ class CiscoVPN3k < Oxidized::Model
2
+ # Used in Cisco VPN3000 concentrators
3
+ # it have buggy code 227 reply with whitespace before trailing bracket
4
+ # "227 Passive mode OK (172,16,0,9,4,9 )"
5
+ # so use active ftp if you can. Or patch net/ftp
6
+
7
+ cmd 'CONFIG'
8
+
9
+ cfg :ftp do
10
+ end
11
+ end
@@ -14,7 +14,7 @@ class Comware < Oxidized::Model
14
14
  cmd :all do |cfg|
15
15
  # cfg.gsub! /^.*\e\[42D/, '' # example how to handle pager
16
16
  # skip rogue ^M
17
- cfg = cfg.gsub /\r/, ''
17
+ cfg = cfg.delete "\r"
18
18
  cfg.cut_both
19
19
  end
20
20
 
@@ -3,7 +3,7 @@ class Cumulus < Oxidized::Model
3
3
  comment '# '
4
4
 
5
5
  # add a comment in the final conf
6
- def add_comment comment
6
+ def add_comment(comment)
7
7
  "\n###### #{comment} ######\n"
8
8
  end
9
9
 
@@ -80,6 +80,8 @@ class Cumulus < Oxidized::Model
80
80
 
81
81
  cfg += add_comment 'License'
82
82
  cfg += cmd 'cl-license'
83
+
84
+ cfg
83
85
  end
84
86
 
85
87
  cfg :telnet do
@@ -21,7 +21,7 @@ class DellX < Oxidized::Model
21
21
 
22
22
  cmd 'show version' do |cfg|
23
23
  if @stackable.nil?
24
- @stackable = true if cfg.match /(U|u)nit\s/
24
+ @stackable = true if cfg =~ /(U|u)nit\s/
25
25
  end
26
26
  cfg = cfg.split("\n").reject { |line| line[/Up\sTime/] }
27
27
  comment cfg.join("\n") + "\n"
@@ -52,18 +52,18 @@ class DellX < Oxidized::Model
52
52
  pre_logout "exit"
53
53
  end
54
54
 
55
- def clean cfg
55
+ def clean(cfg)
56
56
  out = []
57
57
  skip_blocks = 0
58
58
  cfg.each_line do |line|
59
59
  # If this is a stackable switch we should skip this block of information
60
- if line.match /Up\sTime|Temperature|Power Suppl(ies|y)|Fans/i and @stackable == true
60
+ if line.match(/Up\sTime|Temperature|Power Suppl(ies|y)|Fans/i) && (@stackable == true)
61
61
  skip_blocks = 1
62
62
  # Some switches have another empty line. This is identified by this line having a colon
63
- skip_blocks = 2 if line.match /:/
63
+ skip_blocks = 2 if line =~ /:/
64
64
  end
65
65
  # If we have lines to skip do this until we reach and empty line
66
- if skip_blocks > 0
66
+ if skip_blocks.positive?
67
67
  skip_blocks -= 1 if /\S/ !~ line
68
68
  next
69
69
  end
@@ -4,7 +4,7 @@ class Edgeos < Oxidized::Model
4
4
  prompt /@.*?:~\$\s/
5
5
 
6
6
  cmd :all do |cfg|
7
- cfg = cfg.lines.to_a[1..-2].join
7
+ cfg.lines.to_a[1..-2].join
8
8
  end
9
9
 
10
10
  cmd :secret do |cfg|
@@ -6,7 +6,7 @@ class EdgeSwitch < Oxidized::Model
6
6
  prompt /\(.*\)\s[#>]/
7
7
 
8
8
  cmd 'show running-config' do |cfg|
9
- cfg.each_line.to_a[2..-2].reject { |line| line.match /System Up Time.*/ or line.match /Current SNTP Synchronized Time.*/ }.join
9
+ cfg.each_line.to_a[2..-2].reject { |line| line.match(/System Up Time.*/) || line.match(/Current SNTP Synchronized Time.*/) }.join
10
10
  end
11
11
 
12
12
  cfg :telnet do
@@ -6,7 +6,7 @@ class FabricOS < Oxidized::Model
6
6
  comment '# '
7
7
 
8
8
  cmd 'chassisShow' do |cfg|
9
- comment cfg.each_line.reject { |line| line.match /Time Awake:/ or line.match /Power Usage \(Watts\):/ or line.match /Time Alive:/ or line.match /Update:/ }.join
9
+ comment cfg.each_line.reject { |line| line.match(/Time Awake:/) || line.match(/Power Usage \(Watts\):/) || line.match(/Time Alive:/) || line.match(/Update:/) }.join
10
10
  end
11
11
 
12
12
  cmd 'configShow -all' do |cfg|
@@ -38,16 +38,16 @@ class FortiOS < Oxidized::Model
38
38
  cfg = []
39
39
  cfg << cmd('config global') if @vdom_enabled
40
40
 
41
- cfg << cmd('get hardware status') do |cfg|
42
- comment cfg
41
+ cfg << cmd('get hardware status') do |cfg_hw|
42
+ comment cfg_hw
43
43
  end
44
44
 
45
45
  # default behaviour: include autoupdate output (backwards compatibility)
46
46
  # do not include if variable "show_autoupdate" is set to false
47
47
  if defined?(vars(:fortios_autoupdate)).nil? || vars(:fortios_autoupdate)
48
- cfg << cmd('diagnose autoupdate version') do |cfg|
49
- cfg.gsub! /(FDS Address\n---------\n).*/, '\\1IP Address removed'
50
- comment cfg.each_line.reject { |line| line.match /Last Update|Result/ }.join
48
+ cfg << cmd('diagnose autoupdate version') do |cfg_auto|
49
+ cfg_auto.gsub! /(FDS Address\n---------\n).*/, '\\1IP Address removed'
50
+ comment cfg_auto.each_line.reject { |line| line.match /Last Update|Result/ }.join
51
51
  end
52
52
  end
53
53
 
@@ -18,7 +18,7 @@ class FTOS < Oxidized::Model
18
18
 
19
19
  cmd 'show inventory' do |cfg|
20
20
  # Old versions of FTOS can occasionally return data that triggers encoding errors.
21
- cfg.encode!("UTF-8", :invalid => :replace, :undef => :replace, :replace => "")
21
+ cfg.encode!("UTF-8", invalid: :replace, undef: :replace, replace: "")
22
22
  comment cfg
23
23
  end
24
24
 
@@ -37,11 +37,11 @@ class GcomBNPS < Oxidized::Model
37
37
  cmd 'show interface sfp' do |cfg|
38
38
  out = []
39
39
  cfg.each_line do |line|
40
- next if line.match /^ Temperature/
41
- next if line.match /^ Voltage\(V\)/
42
- next if line.match /^ Bias Current\(mA\)/
43
- next if line.match /^ RX Power\(dBM\)/
44
- next if line.match /^ TX Power\(dBM\)/
40
+ next if line =~ /^ Temperature/
41
+ next if line =~ /^ Voltage\(V\)/
42
+ next if line =~ /^ Bias Current\(mA\)/
43
+ next if line =~ /^ RX Power\(dBM\)/
44
+ next if line =~ /^ TX Power\(dBM\)/
45
45
 
46
46
  out << line
47
47
  end
@@ -56,8 +56,8 @@ class GcomBNPS < Oxidized::Model
56
56
  cmd 'show system' do |cfg|
57
57
  out = []
58
58
  cfg.each_line do |line|
59
- next if line.match /^system run time :/
60
- next if line.match /^switch temperature :/
59
+ next if line =~ /^system run time :/
60
+ next if line =~ /^switch temperature :/
61
61
 
62
62
  out << line
63
63
  end