Class: Actions::ForemanCveScanner::CveScannerJob

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.subscribeObject



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

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

Instance Method Details

#finalize(*_args) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/lib/actions/cve_scanner_job.rb', line 16

def finalize(*_args)
  host = Host.find(input[:host_id])
  if host.present?
    cve_scan_report = format_output(task.main_action.continuous_output.humanize)
    report = Hash.new
    report["host"] = host.name
    report["logs"] = []
    report["scan"] = cve_scan_report
    report["reported_at"] = Time.now.utc.to_s
    report['reporter'] = 'cve_scan'
    ConfigReportImporter::import(report)
	end
end

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



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

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