CFINSPEC-68 Adds target_id in the reporter under platform data.

Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
This commit is contained in:
Vasu1105 2022-03-03 15:56:05 +05:30
parent 9fe26f4bc9
commit 2561fd3b43
3 changed files with 3 additions and 2 deletions

View file

@ -73,6 +73,7 @@ module Inspec::Formatters
name: platform(:name),
release: platform(:release),
target: backend_target,
target_id: platform(:uuid),
}
end

View file

@ -21,7 +21,7 @@ module Inspec::Reporters
final_report[:type] = "inspec_report"
final_report[:end_time] = Time.now.utc.strftime("%FT%TZ")
final_report[:node_uuid] = @config["node_uuid"] || @config["target_id"]
final_report[:node_uuid] = report[:platform][:target_id] || @config["node_uuid"] || @config["target_id"]
raise Inspec::ReporterError, "Cannot find a UUID for your node. Please specify one via json-config." if final_report[:node_uuid].nil?
final_report[:report_uuid] = @config["report_uuid"] || uuid_from_string(final_report[:end_time] + final_report[:node_uuid])

View file

@ -29,7 +29,7 @@ module Inspec::Reporters
{
name: run_data[:platform][:name],
release: run_data[:platform][:release],
target_id: @config["target_id"],
target_id: run_data[:platform][:target_id] || @config["target_id"],
}.reject { |_k, v| v.nil? }
end