Bug 2002333

Summary: sosreport syspurpose information not collected in 9
Product: Red Hat Enterprise Linux 9 Reporter: Miroslav Hradílek <mhradile>
Component: sosAssignee: Pavel Moravec <pmoravec>
Status: CLOSED ERRATA QA Contact: Upgrades and Supportability <upgrades-and-supportability>
Severity: medium Docs Contact:
Priority: medium    
Version: 9.0CC: agk, bmr, kfujii, mkluson, plambri, sbradley, theute
Target Milestone: rcKeywords: Triaged
Target Release: 9.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: sos-4.3-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 11:12:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Miroslav Hradílek 2021-09-08 15:01:27 UTC
Description of problem:
There was a request (bug 1654826) in 8 to collect output of "syspurpose show".

This no longer works on 9 because syspurpose command is missing. I was told that syspurpose utility was integrated into subscription manager command.

Version-Release number of selected component (if applicable):
# rpm -q sos subscription-manager
sos-4.1-8.el9.noarch
subscription-manager-1.29.18-2.el9.aarch64

How reproducible:
100%

Steps to Reproduce:
1. sosreport -o subscription_manager --batch
2. tar -tf /var/tmp/sosreport-archive.tar.xz | grep syspurpose_show


Actual results:
Not collected

Expected results:
sosreport-archive/sos_commands/subscription_manager/subscription-manager_syspurpose_--show

Additional info:
Bellow change should fix this to work in both cases (old and new way).

# diff -u /usr/lib/python3.9/site-packages/sos/report/plugins/subscription_manager.py subscription_manager.py 
--- /usr/lib/python3.9/site-packages/sos/report/plugins/subscription_manager.py	2021-02-25 13:46:49.000000000 -0500
+++ subscription_manager.py	2021-09-08 10:33:33.188012366 -0400
@@ -35,7 +35,8 @@
             "subscription-manager identity",
             "subscription-manager release --show",
             "subscription-manager release --list",
-            "syspurpose show"
+            "syspurpose show",
+            "subscription-manager syspurpose --show"
         ])
         self.add_cmd_output("rhsm-debug system --sos --no-archive "
                             "--no-subscriptions --destination %s"

I also noticed that there are several syspurpose.json files collected by the plugin. Not sure if there is a difference between those and syspurpose command output. Was not with my empty (and mocked) syspurpose.
sosreport-archive/etc/rhsm/syspurpose/syspurpose.json
sosreport-archive/var/lib/rhsm/cache/syspurpose.json

Comment 1 Pavel Moravec 2021-09-09 07:07:22 UTC
(This does not explicitly need to backport to backport to RHEL8.6 where "the old syspurpose way" work, but the fix will land there either way to have sos package in par with 9.0 GA)

Good catch, https://github.com/sosreport/sos/pull/2681 raised.

The config files shall by default contain the same data as the syspurpose command collects, though I bet there are use cases where the cmdoutput and configs differ and we must collect both.

Comment 11 Pavel Moravec 2022-03-16 11:47:58 UTC
This will be in 9.1 due to inclusion in sos-4.3 that we will rebase to.

Comment 12 Pavel Moravec 2022-03-18 08:25:10 UTC
(no need to clone to 8.7 as this is rhel9 specific only)

Comment 14 Maros Kopec 2022-04-08 11:50:30 UTC
The automated test /CoreOS/sos/Sanity/plugin-subscription-manager  passed with new build sos-4.3-1.el9

Comment 22 errata-xmlrpc 2022-11-15 11:12:24 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 (sos bug fix and enhancement update), 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/RHEA-2022:8275