Class: Proxy::OpenSCAP::ArfParser

Inherits:
ShellWrapper show all
Defined in:
lib/smart_proxy_openscap/arf_parser.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, #prepare_in_file, #script_location, #unique_filename

Constructor Details

#initialize(cname, policy_id, date) ⇒ ArfParser

Returns a new instance of ArfParser.



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

def initialize(cname, policy_id, date)
  @cname = cname
  @policy_id = policy_id
  @date = date
  @script_name = 'smart-proxy-arf-json'
end

Instance Method Details

#as_json(arf_data) ⇒ Object



14
15
16
# File 'lib/smart_proxy_openscap/arf_parser.rb', line 14

def as_json(arf_data)
  execute_shell_command arf_data
end

#command(in_file, out_file) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/smart_proxy_openscap/arf_parser.rb', line 30

def command(in_file, out_file)
  "#{script_location} " <<
  "#{in_file.path} " <<
  "#{out_file.path} " <<
  "#{Proxy::OpenSCAP::Plugin.settings.registered_proxy_name} " <<
  "#{Proxy::OpenSCAP::Plugin.settings.registered_proxy_url}"
end

#failure_messageObject



26
27
28
# File 'lib/smart_proxy_openscap/arf_parser.rb', line 26

def failure_message
  "Failure when running script which parses reports"
end

#in_filenameObject



18
19
20
# File 'lib/smart_proxy_openscap/arf_parser.rb', line 18

def in_filename
  "#{super}-#{@cname}-#{@policy_id}-#{@date}-"
end

#out_filenameObject



22
23
24
# File 'lib/smart_proxy_openscap/arf_parser.rb', line 22

def out_filename
  "#{in_filename}json-"
end