Class: Actions::ForemanCveScanner::CveScannerJob

Inherits:
EntryAction
  • Object
show all
Defined in:
app/lib/actions/foreman_cve_scanner/cve_scanner_job.rb

Overview

Dynflow action that parses a CVE scan job output and stores the results.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.subscribeObject



7
8
9
# File 'app/lib/actions/foreman_cve_scanner/cve_scanner_job.rb', line 7

def self.subscribe
  Actions::RemoteExecution::RunHostJob
end

Instance Method Details

#finalize(*_args) ⇒ Object



17
18
19
20
21
22
# File 'app/lib/actions/foreman_cve_scanner/cve_scanner_job.rb', line 17

def finalize(*_args)
  host = Host.find(input[:host_id])

  ::ForemanCveScanner::ScanImporter.new(task.main_action.continuous_output)
                                   .import_for_host!(host)
end

#plan(job_invocation, host, *_args) ⇒ Object



11
12
13
14
15
# File 'app/lib/actions/foreman_cve_scanner/cve_scanner_job.rb', line 11

def plan(job_invocation, host, *_args)
  return unless correct_feature?(job_invocation, 'run_cve_scan')

  plan_self(host_id: host.id, job_invocation_id: job_invocation.id)
end