Problem:
Hi All,
We were using chef-handler-foreman (GitHub - theforeman/chef-handler-foreman: This handler allow Chef to send reports to Foreman ) in order to send report to our reporting server.
When we have upgrade the chef-client from 12.x/13.x/14.x to 15.11.8, the report send does not contain all the data.
Here is a diff in the data send for the same cookbook and same action done on server.
on the left, with chef 14 and on the right with 15.
Issue seem to be comming from here as far as i can understand
if times[resource_name].nil?
times[resource_name] = resource.elapsed_time
else
times[resource_name] += resource.elapsed_time
end
end
metrics['time'] = times.merge!({ 'total' => run_status.elapsed_time })
report['metrics'] = metrics
logs = []
run_status.updated_resources.each do |resource|
l = { 'log' => { 'sources' => {}, 'messages' => {}, 'level' => 'notice' } }
case resource.resource_name.to_s
when 'template', 'cookbook_file'
message = resource.diff
when 'package'
message = "Installed #{resource.package_name} package in #{resource.version}"
else
message = resource.action.to_s
end
Expected outcome:
same metrics and info to be send with chef 15 and above.
Hello,
I’m sorry for the late reply. It seem chef-client internals has changed. I no longer have the environment, but I’ll see if there’s a simple fix once I get to it. It shouldn’t be hard to reproduce. I can’t promise any date though.
1 Like