bin/check-tripwire.rb in sensu-plugins-tripwire-1.0.0 vs bin/check-tripwire.rb in sensu-plugins-tripwire-1.1.0

- old
+ new

@@ -96,11 +96,11 @@ tmp_db = "./twd-#{id}" begin open(tmp_db, 'wb') do |db| db << open(database).read end - rescue => e + rescue StandardError => e critical "Error loading database from #{database}. Message #{e.message}" exit 1 end database = tmp_db end @@ -148,21 +148,21 @@ def run begin report = run_tripwire.split("\n") violations = parse_violations report cleanup - rescue => e + rescue StandardError => e cleanup warning "Error running tripwire. #{e. message}" exit 1 end - violations.each do |_name, violation| + violations.each_value do |violation| if violation[:level] >= config[:critical].to_i critical violation.to_json elsif violation[:level] >= config[:warn].to_i warning violation.to_json end end - ok 'no violations' if violations.size == 0 # rubocop:disable Style/ZeroLengthPredicate + ok 'no violations' if violations.size.zero? end end