Module: ForemanCveScanner::ProfilesUploader

Defined in:
app/services/concerns/foreman_cve_scanner/profiles_uploader.rb

Instance Method Summary collapse

Instance Method Details

#uploadObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/services/concerns/foreman_cve_scanner/profiles_uploader.rb', line 5

def upload
  result = super
  return result unless result && Setting[:run_cve_scan_after_host_profiles_upload]

  begin
    composer = ::JobInvocationComposer.for_feature(
      :run_cve_scan,
      @host,
      scanner: Setting[:preferred_cve_scanner]
    )
    composer.trigger!
  rescue StandardError => e
    Rails.logger.error(
      "Failed to schedule CVE scan after host profiles upload: #{e.class}: #{e.message}"
    )
  end

  result
end