bin/check-smart-status.rb in sensu-plugins-disk-checks-2.5.1 vs bin/check-smart-status.rb in sensu-plugins-disk-checks-3.0.0
- old
+ new
@@ -172,11 +172,11 @@
# Check threshold parameter if present
unless config[:threshold].nil?
thresholds = config[:threshold].split(',')
# Check threshold parameter length
- raise 'Invalid threshold parameter count' unless thresholds.size % 5 == 0
+ raise 'Invalid threshold parameter count' unless (thresholds.size % 5).zero?
(0..(thresholds.size / 5 - 1)).each do |i|
att_id = @smart_attributes.index { |att| att[:id] == thresholds[i + 0].to_i }
thash = { crit_min: thresholds[i + 1].to_i,
warn_min: thresholds[i + 2].to_i,
@@ -201,10 +201,11 @@
end
output = {}
warnings = []
criticals = []
- devices.each do |dev|
+ # TODO: refactor me
+ devices.each do |dev| # rubocop:disable Metrics/BlockLength
puts "#{config[:binary]} #{parameters} #{dev.device_path}" if @smart_debug
# check if debug file specified
if config[:debug_file].nil?
output[dev] = `sudo #{config[:binary]} #{parameters} #{dev.device_path}`
else