PATCH: Fix for broken integration of reporters for compliance-mode (#6859)

Signed-off-by: Sonu Saha <sonu.saha@progress.com>
This commit is contained in:
Sonu Saha 2023-11-13 20:10:35 +05:30 committed by GitHub
parent e3708cfa7d
commit c245a4cd28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -470,6 +470,15 @@ module Inspec
# Reporter options may be defined top-level.
options.merge!(config_file_reporter_options)
# when sent reporter from compliance-mode (via chef-client), the reporter is a symbol
if @cli_opts.key?(:reporter) && @cli_opts["reporter"].nil?
@cli_opts["reporter"] = @cli_opts[:reporter]
@cli_opts.delete(:reporter)
elsif @cli_opts.key?(:reporter) && @cli_opts.key?("reporter") && @cli_opts["reporter"].is_a?(Array)
# combine reporter and "reporter" options into "reporter" option
@cli_opts["reporter"] = @cli_opts[:reporter] + @cli_opts["reporter"]
end
if @cli_opts["reporter"]
# Add reporter_cli_opts in options to capture reporter cli opts separately
options.merge!({ "reporter_cli_opts" => @cli_opts["reporter"] })