Hi! I need to modify the code for report templates. Is it possible to make the template export the last 3 reports?
This is to confirm that the host has persistent issues. Here, the host reported one error, but it will clear after the next run, and the host’s status will return to “OK.”
# ...
<%- load_hosts(search: input('hosts'), includes: :host_statuses).each_record do |host| -%>
<% global_status = host.global_status == 0 ? 'OK' : host.global_status == 1 ? 'Warning' : 'Error' -%>
<%- report_row({
'Name': host.name,
'Global': global_status,
'Build': host_status(host, 'Build'),
'Configuration': host_status(host, 'Configuration'),
'Last Report': host.last_report,
}) -%>
<%- end -%>
<%= report_render -%>
Foreman versions:
2.1.4