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

Fixes #36507 - added installable errata count report template #9734

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

snagoor
Copy link
Contributor

@snagoor snagoor commented Jun 15, 2023

New report template to generate the installable errata counts see example below

Host,Security Errata Count,Bugfix Errata Count,Enhancement Errata Count,Upgradable RPM Count
client1.example.com,37,120,2,474
client2.example.com,90,253,9,1002
demo.example.com,29,111,3,430
monitor.example.com,0,0,0,0
test.example.com,0,0,0,0
web.example.com,62,252,7,877

This PR depends on Katello/katello#10607 for safe mode rendering

@theforeman-bot
Copy link
Member

Issues: #36507

<%- load_hosts(search: input('Hosts filter'), preload: [:content_facet]).each_record do |host| -%>
<%- content_facet = host_content_facet(host) -%>
<%-
security_errata_count = content_facet.try(:installable_security_errata_count)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails with Safemode::NoMethodError: undefined method '#try' for Katello::Host::ContentFacet::Jail (Katello::Host::ContentFacet)

Comment on lines 23 to 26
security_errata_count = content_facet.try(:installable_security_errata_count)
bugfix_errata_count = content_facet.try(:installable_bugfix_errata_count)
enhancement_errata_count = content_facet.try(:installable_enhancement_errata_count)
upgradable_rpm_count = content_facet.try(:upgradable_rpm_count)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
security_errata_count = content_facet.try(:installable_security_errata_count)
bugfix_errata_count = content_facet.try(:installable_bugfix_errata_count)
enhancement_errata_count = content_facet.try(:installable_enhancement_errata_count)
upgradable_rpm_count = content_facet.try(:upgradable_rpm_count)
security_errata_count = content_facet ? content_facet.installable_security_errata_count : 0
bugfix_errata_count = content_facet ? content_facet.installable_bugfix_errata_count : 0
enhancement_errata_count = content_facet ? content_facet.installable_enhancement_errata_count : 0
upgradable_rpm_count = content_facet ? content_facet.upgradable_rpm_count : 0

This resolved it for me

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wbclark First of all apologies for the delay, as I was caught up in multiple other tasks. Thanks for the suggestions, I amended the changes that you suggested. When you can please take a look again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants