Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 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 "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". 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 "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-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 1652474

Summary: System purpose status can not be shown when system is unregistered
Product: Red Hat Enterprise Linux 8 Reporter: qianzhan
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED WORKSFORME QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.0CC: csnyder, qianzhan, sgao
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-12-12 03:05:29 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:
Attachments:
Description Flags
'rhsm.log' none

Description qianzhan 2018-11-22 08:18:05 UTC
Description of problem:
System purpose status can not be shown when system is unregistered 

Version-Release number of selected component (if applicable):
subscription-manager-1.23.8-1.el8.x86_64
tfm-rubygem-katello-3.9.0-0.2.rc2.el7sat.noarch


How reproducible:
always

Steps to Reproduce:
1. Run 'subscription-manager status' on RHEL-8.0-Snapshot-1.0 before registration:

[root@dell-r730-001-guest03 ~]# subscription-manager status
+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Unknown

Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 11, in <module>
    load_entry_point('subscription-manager==1.23.8', 'console_scripts', 'subscription-manager')()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/scripts/subscription_manager.py", line 85, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 2879, in main
    ret = CLI.main(self)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cli.py", line 183, in main
    return cmd.main()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 507, in main
    return_code = self._do_command()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 2860, in _do_command
    print(_("System Purpose Status: %s\n") % syspurpose_service.get_syspurpose_status())
  File "/usr/lib64/python3.6/site-packages/rhsmlib/services/syspurpose.py", line 32, in get_syspurpose_status
    consumer = self.cp.getConsumer(self.identity.uuid)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 1179, in getConsumer
    return self.conn.request_get(method)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 739, in request_get
    return self._request("GET", method, headers=headers)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 765, in _request
    info=info, headers=headers)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 643, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 702, in validateResponse
    raise RestlibException(response['status'], error_msg, response.get('headers'))
rhsm.connection.RestlibException: HTTP error (404 - Not Found): Consumer with id None could not be found.
[root@dell-r730-001-guest03 ~]# syspurpose show
{
  "service_level_agreement": "",
  "addons": [
    ""
  ],
  "usage": "",
  "role": ""
}


2. Register the system against Satellite6.5-snapshot4.0:

[root@dell-r730-001-guest03 ~]# subscription-manager  register
Registering to: ibm-ls22-03.rhts.eng.brq.redhat.com:443/rhsm
Username: admin                                                                                                                                                                          
Password: 
The system has been registered with ID: 936a0302-b0df-4f21-90bb-0161161c343e
The registered system name is: dell-r730-001-guest03.dsal.lab.eng.rdu2.redhat.com
Failed to synchronize cache for repo 'myrepo_0', ignoring this repo.

3. Run 'subscription-manager status' after registration:

[root@dell-r730-001-guest03 ~]# subscription-manager status
+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Invalid

Red Hat Enterprise Linux for x86_64 High Touch Beta:
- Not supported by a valid subscription.

System Purpose Status: Unknown



Actual results:
As step 1, system purpose status can not be displayed when system is unregistered.

Expected results:
The output of step 1, should be like:

# subscription-manager status
+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Unknown

System Purpose Status: Unknown

Additional info:
The attachment is rhsm.log

Comment 1 qianzhan 2018-11-22 08:18:32 UTC
Created attachment 1507885 [details]
'rhsm.log'

Comment 2 qianzhan 2018-12-05 07:16:11 UTC
This bug can not be reproduced with RHEL-8.0-20181204.0 and Satellite6.5-snapshot6.0. Please see bug 1656279.

Comment 3 Chris Snyder 2018-12-10 15:36:11 UTC
I believe this will have been fixed in a newer version of subscription-manager (the one included in Snap 2).
Should this be moved to Closed-Worksforme as of the new build? subscription-manager-1.23.8-4

Comment 4 qianzhan 2018-12-12 03:05:29 UTC
Hi Chris,

Yes, I can not reproduce this bug per Comment2.
It would be Okay for me to close it as Worksforme.