lib/salus/scanners/base.rb
# Wraps the actual workhorse #run method with some boilerplate:
# - appends the scan report to the given global salus report
# - uses the #record method of @report to record the running time of the scan,
#   and also to pass/fail the scan if #run failed to do so
# - catches any exceptions, appending them to both the scan report's error
#   collection and the global salus scan's error collection
Wraps the actual workhorse #run method with some boilerplate:
appends the scan report to the given global salus report
uses the #record method of @report to record the running time of the scan,
and also to pass/fail the scan if #run failed to do so
catches any exceptions, appending them to both the scan report's error
collection and the global salus scan's error collection
Wraps the actual workhorse #run method with some boilerplate : appends the scan report to the given global salus report uses the #record method of @report to record the running time of the scan and also to pass / fail the scan if #run failed to do so catches any exceptions appending them to both the scan report ' s error collection and the global salus scan ' s error collection
def run!(salus_report:, required:, pass_on_raise:, reraise:)
      @salus_report = salus_report
      salus_report.add_scan_report(@report, required: required)
      begin
        @report.record { run }
        if @report.errors.any?
          pass_on_raise ? @report.pass : @report.fail
        end
      rescue StandardError => e
        error_data = {
          message: "Unhandled exception running #{name}: #{e.class}: #{e}",
          error_class: e.class,
          backtrace: e.backtrace.take(5)
        }
        pass_on_raise ? @report.pass : @report.fail
        @report.error(error_data)
        salus_report.error(error_data)
        raise if reraise
      end
    end
def run! ( salus_report : , required : , pass_on_raise : , reraise : ) @salus_report = salus_report salus_report . add_scan_report ( @report , required : required ) begin @report . record { run } if @report . errors . any? pass_on_raise ? @report . pass : @report . fail end rescue StandardError => e error_data = { message : "Unhandled exception running #{name}: #{e.class}: #{e}" , error_class : e . class , backtrace : e . backtrace . take ( 5 ) } pass_on_raise ? @report . pass : @report . fail @report . error ( error_data ) salus_report . error ( error_data ) raise if reraise end end
Wraps the actual workhorse #run method with some boilerplate:
 appends the scan report to the given global salus report
 uses the #record method of @report to record the running time of the scan,
and also to pass/fail the scan if #run failed to do so
 catches any exceptions, appending them to both the scan report's error
collection and the global salus scan's error collection
Wraps the actual workhorse #run method with some boilerplate : appends the scan report to the given global salus report uses the #record method of @report to record the running time of the scan and also to pass / fail the scan if #run failed to do so catches any exceptions appending them to both the scan report ' s error collection and the global salus scan ' s error collection
# Record the error so that the Salus report captures the issue.
salus_report
required
pass_on_raise
reraise