Class: Proxy::OpenSCAP::PolicyGuide

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

Instance Method Summary collapse

Instance Method Details

#generate_guide(in_file, out_file, policy = nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/smart_proxy_openscap/policy_guide.rb', line 9

def generate_guide(in_file, out_file, policy=nil)
  ::OpenSCAP.oscap_init
  source = ::OpenSCAP::Source.new in_file
  sds = ::OpenSCAP::DS::Sds.new source
  sds.select_checklist
  html = sds.html_guide policy
  File.write(out_file, { :html => html.force_encoding('UTF-8') }.to_json)
ensure
  sds.destroy if sds
  source.destroy if source
  ::OpenSCAP.oscap_cleanup
end