Class: Proxy::OpenSCAP::PolicyGuide
- Inherits:
-
Object
- Object
- Proxy::OpenSCAP::PolicyGuide
- Includes:
- Log
- Defined in:
- lib/smart_proxy_openscap/policy_guide.rb
Instance Method Summary collapse
Instance Method Details
#generate_guide(file_content, policy_id) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/smart_proxy_openscap/policy_guide.rb', line 8 def generate_guide(file_content, policy_id) Tempfile.create do |file| file.write file_content file.flush command = ['oscap', 'xccdf', 'generate'] + profile_opt(policy_id) + ['guide', file.path] Proxy::OpenSCAP.execute!(*command).first end rescue => e logger.debug e. logger.debug e.backtrace.join("\n\t") raise OpenSCAPException, "Failed to generate policy guide, cause: #{e.}" end |
#profile_opt(policy_id) ⇒ Object
21 22 23 |
# File 'lib/smart_proxy_openscap/policy_guide.rb', line 21 def profile_opt(policy_id) policy_id ? ['--profile', policy_id] : [] end |