Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1826648 - [RFE] new report template to list all the installed packages
Summary: [RFE] new report template to list all the installed packages
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Reporting
Version: 6.7.0
Hardware: All
OS: All
high
high
Target Milestone: 6.13.0
Assignee: Waldirio M Pinheiro
QA Contact: Cole Higgins
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-04-22 08:44 UTC by Waldirio M Pinheiro
Modified: 2023-09-07 22:54 UTC (History)
5 users (show)

Fixed In Version: foreman-3.5.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-05-03 13:20:33 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 29590 0 Normal Ready For Testing new report template to list all the installed packages 2022-08-19 17:17:50 UTC
Red Hat Issue Tracker SAT-14319 0 None None None 2023-05-11 10:12:04 UTC
Red Hat Issue Tracker SAT-15741 0 None None None 2023-05-11 10:12:01 UTC
Red Hat Product Errata RHSA-2023:2097 0 None None None 2023-05-03 13:21:00 UTC

Description Waldirio M Pinheiro 2020-04-22 08:44:08 UTC
Description of problem:
The customer would like to generate a list of the installed packages for a system or all of them.

Version-Release number of selected component (if applicable):
6.7

How reproducible:
100%

Steps to Reproduce:
1. Install satellite 6.7
2. Create the report template
3. Copy/paste the code below

Actual results:
We don't ship this report on Satellite 6.7

Expected results:
Be able to run this report template and generate the list when necessary

Additional info:

Comment 3 Waldirio M Pinheiro 2020-04-22 08:46:05 UTC
Hi

Below the code

---
$ cat host_-_all_installed_packages.erb 
<%#
name: Host - All Installed Packages
snippet: false
template_inputs:
- name: hosts
  required: false
  input_type: user
  advanced: false
  value_type: plain
  resource_type: Katello::ActivationKey
  hidden_value: false
model: ReportTemplate
%>
<%  load_hosts(search: input('hosts')).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
      )-%>
<%    end -%>
<%  end -%>
<%= report_render -%>
---

Ps.: This is running fine on Satellite 6.7, however, in 6.6 it's necessary to change the safemode to "No". Checking the backport possibility.

Thank you!
Waldirio

Comment 5 Waldirio M Pinheiro 2020-04-22 19:32:02 UTC
Hello,

Below the workaround, if the customer is looking for this kind of report

There we are, now, let's automate this process to generate the same kind of information to all of your content hosts
 
---
#!/bin/bash
 
for b in $(hammer --csv --no-headers host list --thin 1 --search 'name !~ virt-who*' | cut -d, -f2)
do
 for i in $(hammer --csv --no-headers host package list --host $b --search 'nvra ~ iptraf or yum or zlib')
 do
echo "$b,$i"
 done
done
---
 
 
Cool, with the script above, we will get the output as below
 
---
[root@wallsat66 installed_packages]# ./installed_packages.sh
dhcp-8-29-139.lab.eng.rdu2.redhat.com,yum-3.4.3-158.el7.noarch
dhcp-8-29-139.lab.eng.rdu2.redhat.com,yum-metadata-parser-1.1.4-10.el7.x86_64
dhcp-8-29-139.lab.eng.rdu2.redhat.com,yum-rhn-plugin-2.0.1-10.el7.noarch
dhcp-8-29-139.lab.eng.rdu2.redhat.com,zlib-1.2.7-17.el7.x86_64
...
---

Comment 7 Bryan Kearney 2020-05-11 16:05:25 UTC
Upstream bug assigned to wpinheir

Comment 9 Bryan Kearney 2022-11-01 16:01:30 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/29590 has been resolved.

Comment 16 errata-xmlrpc 2023-05-03 13:20:33 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: Satellite 6.13 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:2097


Note You need to log in before you can comment on or make changes to this bug.