Class: Proxy::OpenSCAP::ArfHtml

Inherits:
Object
  • Object
show all
Includes:
Log
Defined in:
lib/smart_proxy_openscap/arf_html.rb

Instance Method Summary collapse

Instance Method Details

#as_html(file_in_storage) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/smart_proxy_openscap/arf_html.rb', line 14

def as_html(file_in_storage)
  Proxy::OpenSCAP.execute!('oscap', 'xccdf', 'generate', 'report', file_in_storage).first
rescue => e
  logger.debug e.message
  logger.debug e.backtrace.join("\n\t")
  raise Proxy::OpenSCAP::ReportDecompressError, "Failed to generate report HTML, cause: #{e.message}"
end

#file_path_in_storage(cname, id, date, digest) ⇒ Object



22
23
24
25
26
# File 'lib/smart_proxy_openscap/arf_html.rb', line 22

def file_path_in_storage(cname, id, date, digest)
  path_to_dir = Proxy::OpenSCAP::Plugin.settings.reportsdir
  storage = Proxy::OpenSCAP::StorageFs.new(path_to_dir, cname, id, date)
  storage.get_path(digest)
end

#generate(cname, id, date, digest) ⇒ Object



9
10
11
12
# File 'lib/smart_proxy_openscap/arf_html.rb', line 9

def generate(cname, id, date, digest)
  file_path = file_path_in_storage cname, id, date, digest
  as_html file_path
end