Report template: documentation for newbie

Hello,
I would like to make my own report template but I haven’t found any documentation. I’ve seen the default reports:

<%- load_hosts(search: input('Hosts filter'), includes: [:operatingsystem, :subscriptions, :kernel_release, :interfaces, :owner, :applicable_errata, :applicable_rpms]).each_record do |host| -%>
<%-   report_row(
        'Name': host.name,
        'Ip': host.ip,
        'Operating System': host.operatingsystem,
        'Subscriptions': host_subscriptions(host),
        'Applicable Errata': host_applicable_errata_ids(host),
        'Owner': host.owner,
        'Kernel': host_kernel_release(host),
        'Latest kernel available': host_latest_applicable_rpm_version(host, 'kernel')
      ) -%>
<%- end -%>
<%= report_render -%>

with load_hosts and load_pools to get information from Foreman. Which others are there?
How can I see all values they can show me to use in report_row block to construct the output?
What about search and includes to filter the results of the loads? How they works? Are there others?

Are there any documentation about all my questions? I’m missed and I don’t want to modified the existing templates without undestand it and based only in try&error method.

Thank you!!

I would like to know the same. Can anyone help answer this question?

Sergiodcm00

1

Sep '19

Hello,
I would like to make my own report template but I haven’t found any documentation. I’ve seen the default reports:

<%- load_hosts(search: input('Hosts filter'), includes: [:operatingsystem, :subscriptions, :kernel_release, :interfaces, :owner, :applicable_errata, :applicable_rpms]).each_record do |host| -%>
<%-   report_row(
        'Name': host.name,
        'Ip': host.ip,
        'Operating System': host.operatingsystem,
        'Subscriptions': host_subscriptions(host),
        'Applicable Errata': host_applicable_errata_ids(host),
        'Owner': host.owner,
        'Kernel': host_kernel_release(host),
        'Latest kernel available': host_latest_applicable_rpm_version(host, 'kernel')
      ) -%>
<%- end -%>
<%= report_render -%>

with load_hosts and load_pools to get information from Foreman. Which others are there?
How can I see all values they can show me to use in report_row block to construct the output?
What about search and includes to filter the results of the loads? How they works? Are there others?

Are there any documentation about all my questions? I’m missed and I don’t want to modified the existing templates without undestand it and based only in try&error method.

Thank you!!

Hi @Sergiodcm00 and @flaporta,

So sorry your messages were noiced just now :frowning:

If you want to make your own report (or actually any) template, you can find some basic notes/docs in Help tab while creating one. But also since Foreman 2.2.0 there should be a new docs section similar to API docs under https://foreman.example.com/templates_doc. Also you can find it on About page.

Please, let me know if new templates DSL documentation helped you somehow. Also, I’d glad to hear any suggestion to improve those pages.

You can find some docs here too:

https://docs.theforeman.org/nightly/Managing_Hosts/index-foreman-el.html#using_report_templates