Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make entity_uuid work for Chef Infra 15 #371

Merged
merged 1 commit into from
May 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions files/default/handler/audit_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ def send_report(reporter, server, user, source_location, report)

# TODO: harmonize reporter interface
if reporter == 'chef-visibility' || reporter == 'chef-automate'
# `run_status.entity_uuid` is calling the `entity_uuid` method in libraries/helper.rb
opts = {
entity_uuid: run_status.entity_uuid,
run_id: run_status.run_id,
Expand All @@ -242,6 +243,7 @@ def send_report(reporter, server, user, source_location, report)
chef_org = Chef::Config[:chef_server_url].split('/').last
if chef_url
url = construct_url(chef_url, File.join('organizations', chef_org, 'data-collector'))
# `run_status.entity_uuid` is calling the `entity_uuid` method in libraries/helper.rb
opts = {
entity_uuid: run_status.entity_uuid,
run_id: run_status.run_id,
Expand Down
8 changes: 2 additions & 6 deletions libraries/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@ def run_id

# Returns the node's uuid
def entity_uuid
if defined?(Chef) &&
defined?(Chef::DataCollector) &&
defined?(Chef::DataCollector::Messages) &&
defined?(Chef::DataCollector::Messages.node_uuid)
Chef::DataCollector::Messages.node_uuid
end
# the Chef::DataCollector::Messages API here is Chef < 15.0 backcompat and can be removed when Chef 14.x is no longer supported
node[:chef_guid] || defined?(Chef::DataCollector::Messages) && Chef::DataCollector::Messages.node_uuid
end

# Convert the strings in the profile definitions into symbols for handling
Expand Down