Problem:
After putting the below report together to try and generate a report for packages that will be updated and what version they will be updated too i find that the new latest applicable is just the next version in the list, not actually the latest one
Current output
zabbix-agent2 zabbix-agent2-5.4.1-1.sles15.x86_64 zabbix-agent2-5.4.1-1.sles15.x86_64 zabbix-agent2-5.4.2-1.sles15.x86_64
Expected outcome:
the latest zabbix-agent2 should be zabbix-agent2-5.4.4-1.sles15.x86_64 as thats the latest available if i go to Content → Packages → Search zabbix-agent2 it shows that applicable for the servers
Foreman and Proxy versions:
foreman-2.5.1-1.el7.noarch
katello-4.1.0-1.el7.noarch
Smart Proxy: 2.5.1
Foreman and Proxy plugin versions:
Distribution and version:
CentOS 7
Other relevant data:
Sample report
<%#
name: Host - All Installed Packages
snippet: false
template_inputs:
- name: Hosts filter
required: false
input_type: user
description: Limit the report only on hosts found by this search query. Keep empty
for report on all available hosts.
advanced: false
value_type: search
resource_type: Host
hidden_value: false
model: ReportTemplate
-%>
<%- load_hosts(search: input(‘Hosts filter’)).each_record do |host| -%>
<%- host.installed_packages.each do |pkg| -%>
<%- report_row(
‘Host’: host.name,
‘Package Name’: pkg.name,
‘Package NVRA’: pkg.nvra,
‘Package NVREA’: pkg.nvrea,
‘Package New NVRA’: host_latest_applicable_rpm_version(host, pkg.name)
)-%>
<%- end -%>
<%- end -%>
<%= report_render -%>