Class: Inspec::Reporters::JsonAutomate
- Defined in:
- lib/inspec/reporters/json_automate.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(config) ⇒ JsonAutomate
constructor
A new instance of JsonAutomate.
- #render ⇒ Object
- #report ⇒ Object
Methods inherited from Base
Methods included from Utils::RunDataFilters
#apply_report_resize_options, #apply_run_data_filters_to_hash, #filter_empty_profiles, #redact_sensitive_inputs, #sort_controls, #suppress_diff_output
Constructor Details
#initialize(config) ⇒ JsonAutomate
Returns a new instance of JsonAutomate.
5 6 7 8 |
# File 'lib/inspec/reporters/json_automate.rb', line 5 def initialize(config) super(config) @profiles = [] end |
Instance Method Details
#render ⇒ Object
10 11 12 |
# File 'lib/inspec/reporters/json_automate.rb', line 10 def render output(report.to_json, false) end |
#report ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/inspec/reporters/json_automate.rb', line 14 def report # grab profiles from the json parent class @profiles = profiles output = { platform: platform, profiles: merge_profiles, statistics: { duration: run_data[:statistics][:duration], }, version: run_data[:version], } # optional jsonconfig passthrough options %w{node_name environment roles job_uuid passthrough}.each do |option| output[option.to_sym] = @config[option] unless @config[option].nil? end output end |