Class: Proxy::OpenSCAP::OpenscapHtmlGenerator

Inherits:
ShellWrapper
  • Object
show all
Defined in:
lib/smart_proxy_openscap/openscap_html_generator.rb

Instance Attribute Summary

Attributes inherited from ShellWrapper

#script_name

Instance Method Summary collapse

Methods inherited from ShellWrapper

#close_unlink, #exception_message, #execute_shell_command, #in_filename, #prepare_in_file, #script_location, #unique_filename

Constructor Details

#initialize(cname, id, date, digest) ⇒ OpenscapHtmlGenerator

Returns a new instance of OpenscapHtmlGenerator.



7
8
9
10
11
12
13
# File 'lib/smart_proxy_openscap/openscap_html_generator.rb', line 7

def initialize(cname, id, date, digest)
  @cname = cname
  @id = id
  @date = date
  @digest = digest
  @script_name = 'smart-proxy-arf-html'
end

Instance Method Details

#command(in_file, out_file) ⇒ Object



23
24
25
# File 'lib/smart_proxy_openscap/openscap_html_generator.rb', line 23

def command(in_file, out_file)
  "#{script_location} #{file_path_in_storage} #{out_file.path}"
end

#failure_messageObject



27
28
29
# File 'lib/smart_proxy_openscap/openscap_html_generator.rb', line 27

def failure_message
  "Failure when running script which generates html reports"
end

#file_path_in_storageObject



31
32
33
34
35
# File 'lib/smart_proxy_openscap/openscap_html_generator.rb', line 31

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

#get_htmlObject



15
16
17
# File 'lib/smart_proxy_openscap/openscap_html_generator.rb', line 15

def get_html
  execute_shell_command
end

#out_filenameObject



19
20
21
# File 'lib/smart_proxy_openscap/openscap_html_generator.rb', line 19

def out_filename
  "#{super}-#{@cname}-#{@id}-#{@date}-#{@digest}-"
end