Bug 2026013

Summary: Needs consistent error message in syspurpose modules(role/usage/addon) when an invalid org is used
Product: Red Hat Enterprise Linux 8 Reporter: Rehana <redakkan>
Component: subscription-managerAssignee: Pino Toscano <ptoscano>
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.6CC: arpandey, csnyder, jsefler
Target Milestone: rcKeywords: Triaged
Target Release: 8.6   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: subscription-manager-1.28.25-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2026286 (view as bug list) Environment:
Last Closed: 2022-05-10 15:22:58 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:
Bug Depends On:    
Bug Blocks: 2026286, 2037902    

Description Rehana 2021-11-23 16:11:10 UTC
Description of problem:
When a user belong to single org tries to list syspurpose values on role/usage/addon with invalid org is succeeds while the old service-level module continues to fail 

Version-Release number of selected component (if applicable):
subscription management server: 3.2.21-1
subscription management rules: 5.41
subscription-manager: 1.28.24-1.el8

How reproducible:
always 

Steps to Reproduce:
1.On a unregistered system try to list syspurpose values with invalid org

# subscription-manager usage --list --username=rhsm_nonsca_1 --password=**** --org=foo
+-------------------------------------------+
               Available usage
+-------------------------------------------+
 - Production

# echo $?
0

# subscription-manager role --list --username=rhsm_nonsca_1 --password=**** --org=foo
+-------------------------------------------+
               Available role
+-------------------------------------------+
 - Red Hat Enterprise Linux Server

# echo $?
0


# subscription-manager addons --list --username=rhsm_nonsca_1 --password=**** --org=foo
There are no available values for the system purpose "addons" from the available subscriptions in this organization.

# echo $?
0

Notice the service-level module fails in this scenario 
# subscription-manager service-level --list --username=rhsm_nonsca_1 --password=**** --org=foo
Organization with id foo could not be found. (HTTP error code 404: Not Found)

# echo $?
65
Actual results:
only service-level module fails in this scenario

Expected results:
all the other syspurpose module should also fail similar to service-level

Additional info:
We should make sure to be consistent with  similar scenarios in subscription-manager

Comment 1 Archana Pandey 2021-12-27 07:18:28 UTC
Preverification on jenkins build:

reproducing issue on : subscription-manager: 1.28.24-1.el8

[root@hpe-dl380pgen8-02-vm-6 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 3.2.21-1
subscription management rules: 5.41
subscription-manager: 1.28.24-1.el8
[root@hpe-dl380pgen8-02-vm-6 ~]# subscription-manager service-level --list --username rhel9GA --password ******* --org=foo
Organization with id foo could not be found. (HTTP error code 404: Not Found)
[root@hpe-dl380pgen8-02-vm-6 ~]# 
[root@hpe-dl380pgen8-02-vm-6 ~]# subscription-manager role --list --username rhel9GA --password ******* --org=foo
+-------------------------------------------+
               Available role                                                                                         <<<<<<<<< org name ignored, should have thrown error
+-------------------------------------------+
 - Red Hat Enterprise Linux Server
[root@hpe-dl380pgen8-02-vm-6 ~]# 
[root@hpe-dl380pgen8-02-vm-6 ~]# subscription-manager usage --list --username rhel9GA --password ******* --org=foo
+-------------------------------------------+
               Available usage
+-------------------------------------------+                                                                         <<<<<<<<< org name ignored, should have thrown error
 - Production
[root@hpe-dl380pgen8-02-vm-6 ~]# subscription-manager  addons --list --username rhel9GA --password ******* --org=foo
There are no available values for the system purpose "addons" from the available subscriptions in this organization.   <<<<<<<<< org name ignored, should have thrown error
[root@hpe-dl380pgen8-02-vm-6 ~]#  
[root@hpe-dl380pgen8-02-vm-6 ~]# 
[root@hpe-dl380pgen8-02-vm-6 ~]# 


lets install latest build from jenkins and verify-

[root@hpe-dl380pgen8-02-vm-6 ~]# yum upgrade subscription-manager
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 0:08:16 ago on Mon 27 Dec 2021 01:31:24 AM EST.
Dependencies resolved.
==============================================================================================================================================================================================
 Package                                                       Architecture                  Version                                                Repository                           Size
==============================================================================================================================================================================================
Upgrading:
 python3-cloud-what                                            x86_64                        1.28.24-1.git.48.018ca2f.el8                           rhsm_RHEL8.6                        304 k
 python3-subscription-manager-rhsm                             x86_64                        1.28.24-1.git.48.018ca2f.el8                           rhsm_RHEL8.6                        382 k
 python3-syspurpose                                            x86_64                        1.28.24-1.git.48.018ca2f.el8                           rhsm_RHEL8.6                        321 k
 subscription-manager                                          x86_64                        1.28.24-1.git.48.018ca2f.el8                           rhsm_RHEL8.6                        1.2 M
 subscription-manager-rhsm-certificates                        x86_64                        1.28.24-1.git.48.018ca2f.el8                           rhsm_RHEL8.6                        278 k

Transaction Summary
==============================================================================================================================================================================================
Upgrade  5 Packages

Total download size: 2.4 M
Is this ok [y/N]: y
Downloading Packages:
(1/5): python3-cloud-what-1.28.24-1.git.48.018ca2f.el8.x86_64.rpm                                                                                             1.0 MB/s | 304 kB     00:00    
(2/5): python3-subscription-manager-rhsm-1.28.24-1.git.48.018ca2f.el8.x86_64.rpm                                                                              1.3 MB/s | 382 kB     00:00    
(3/5): python3-syspurpose-1.28.24-1.git.48.018ca2f.el8.x86_64.rpm                                                                                             1.0 MB/s | 321 kB     00:00    
(4/5): subscription-manager-rhsm-certificates-1.28.24-1.git.48.018ca2f.el8.x86_64.rpm                                                                         2.7 MB/s | 278 kB     00:00    
(5/5): subscription-manager-1.28.24-1.git.48.018ca2f.el8.x86_64.rpm                                                                                           8.8 MB/s | 1.2 MB     00:00    
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                         5.6 MB/s | 2.4 MB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                      1/1 
  Running scriptlet: python3-cloud-what-1.28.24-1.git.48.018ca2f.el8.x86_64                                                                                                               1/1 
  Upgrading        : python3-cloud-what-1.28.24-1.git.48.018ca2f.el8.x86_64                                                                                                              1/10 
  Upgrading        : subscription-manager-rhsm-certificates-1.28.24-1.git.48.018ca2f.el8.x86_64                                                                                          2/10 
  Upgrading        : python3-subscription-manager-rhsm-1.28.24-1.git.48.018ca2f.el8.x86_64                                                                                               3/10 
  Upgrading        : python3-syspurpose-1.28.24-1.git.48.018ca2f.el8.x86_64                                                                                                              4/10 
  Running scriptlet: subscription-manager-1.28.24-1.git.48.018ca2f.el8.x86_64                                                                                                            5/10 
  Upgrading        : subscription-manager-1.28.24-1.git.48.018ca2f.el8.x86_64                                                                                                            5/10 
  Running scriptlet: subscription-manager-1.28.24-1.git.48.018ca2f.el8.x86_64                                                                                                            5/10 
  Running scriptlet: subscription-manager-1.28.24-1.el8.x86_64                                                                                                                           6/10 
  Cleanup          : subscription-manager-1.28.24-1.el8.x86_64                                                                                                                           6/10 
  Running scriptlet: subscription-manager-1.28.24-1.el8.x86_64                                                                                                                           6/10 
  Cleanup          : python3-syspurpose-1.28.24-1.el8.x86_64                                                                                                                             7/10 
  Cleanup          : python3-subscription-manager-rhsm-1.28.24-1.el8.x86_64                                                                                                              8/10 
  Cleanup          : python3-cloud-what-1.28.24-1.el8.x86_64                                                                                                                             9/10 
  Cleanup          : subscription-manager-rhsm-certificates-1.28.24-1.el8.x86_64                                                                                                        10/10 
  Running scriptlet: subscription-manager-rhsm-certificates-1.28.24-1.el8.x86_64                                                                                                        10/10 
  Verifying        : python3-cloud-what-1.28.24-1.git.48.018ca2f.el8.x86_64                                                                                                              1/10 
  Verifying        : python3-cloud-what-1.28.24-1.el8.x86_64                                                                                                                             2/10 
  Verifying        : python3-subscription-manager-rhsm-1.28.24-1.git.48.018ca2f.el8.x86_64                                                                                               3/10 
  Verifying        : python3-subscription-manager-rhsm-1.28.24-1.el8.x86_64                                                                                                              4/10 
  Verifying        : python3-syspurpose-1.28.24-1.git.48.018ca2f.el8.x86_64                                                                                                              5/10 
  Verifying        : python3-syspurpose-1.28.24-1.el8.x86_64                                                                                                                             6/10 
  Verifying        : subscription-manager-1.28.24-1.git.48.018ca2f.el8.x86_64                                                                                                            7/10 
  Verifying        : subscription-manager-1.28.24-1.el8.x86_64                                                                                                                           8/10 
  Verifying        : subscription-manager-rhsm-certificates-1.28.24-1.git.48.018ca2f.el8.x86_64                                                                                          9/10 
  Verifying        : subscription-manager-rhsm-certificates-1.28.24-1.el8.x86_64                                                                                                        10/10 
Installed products updated.

Upgraded:
  python3-cloud-what-1.28.24-1.git.48.018ca2f.el8.x86_64   python3-subscription-manager-rhsm-1.28.24-1.git.48.018ca2f.el8.x86_64      python3-syspurpose-1.28.24-1.git.48.018ca2f.el8.x86_64
  subscription-manager-1.28.24-1.git.48.018ca2f.el8.x86_64 subscription-manager-rhsm-certificates-1.28.24-1.git.48.018ca2f.el8.x86_64

Complete!
[root@hpe-dl380pgen8-02-vm-6 ~]# 
[root@hpe-dl380pgen8-02-vm-6 ~]# 
[root@hpe-dl380pgen8-02-vm-6 ~]# 
[root@hpe-dl380pgen8-02-vm-6 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 3.2.21-1
subscription management rules: 5.41
subscription-manager: 1.28.24-1.git.48.018ca2f.el8
[root@hpe-dl380pgen8-02-vm-6 ~]# subscription-manager  addons --list --username rhel9GA --password ******* --org=foo
Organization with id foo could not be found. (HTTP error code 404: Not Found)                           <<<< as expected, consistent error message being shown
[root@hpe-dl380pgen8-02-vm-6 ~]# 
[root@hpe-dl380pgen8-02-vm-6 ~]# subscription-manager role --list --username rhel9GA --password ******* --org=foo
Organization with id foo could not be found. (HTTP error code 404: Not Found)                           <<<< as expected, consistent error message being shown
[root@hpe-dl380pgen8-02-vm-6 ~]# subscription-manager service-level --list --username rhel9GA --password ******* --org=foo
Organization with id foo could not be found. (HTTP error code 404: Not Found)                           <<<< as expected, consistent error message being shown
[root@hpe-dl380pgen8-02-vm-6 ~]# 
[root@hpe-dl380pgen8-02-vm-6 ~]# subscription-manager usage --list --username rhel9GA --password ******* --org=foo
Organization with id foo could not be found. (HTTP error code 404: Not Found)                           <<<< as expected, consistent error message being shown
[root@hpe-dl380pgen8-02-vm-6 ~]# 

Lets verify sub-man syspurpose module also-

[root@hpe-dl380pgen8-02-vm-6 ~]# 
[root@hpe-dl380pgen8-02-vm-6 ~]# subscription-manager syspurpose service-level --list --username rhel9GA --password ******* --org=foo
Organization with id foo could not be found. (HTTP error code 404: Not Found)   <<<<<<<<<<<< expected error message
[root@hpe-dl380pgen8-02-vm-6 ~]# 
[root@hpe-dl380pgen8-02-vm-6 ~]# subscription-manager syspurpose role --list --username rhel9GA --password ******* --org=foo
Organization with id foo could not be found. (HTTP error code 404: Not Found)   <<<<<<<<<<<< expected error message
[root@hpe-dl380pgen8-02-vm-6 ~]# 
[root@hpe-dl380pgen8-02-vm-6 ~]# subscription-manager syspurpose usage --list --username rhel9GA --password ******* --org=foo
Organization with id foo could not be found. (HTTP error code 404: Not Found)   <<<<<<<<<<<< expected error message
[root@hpe-dl380pgen8-02-vm-6 ~]# 
[root@hpe-dl380pgen8-02-vm-6 ~]# subscription-manager syspurpose addons --list --username rhel9GA --password ******* --org=foo
Organization with id foo could not be found. (HTTP error code 404: Not Found)   <<<<<<<<<<<< expected error message
[root@hpe-dl380pgen8-02-vm-6 ~]# 


Verification result:PASSED - All the syspurpose modules(role/usage/service-level/addons) failing with consistent error message for incorrect org value

Comment 2 Chris Snyder 2022-01-07 14:43:08 UTC
*** Bug 2037902 has been marked as a duplicate of this bug. ***

Comment 5 Archana Pandey 2022-01-11 13:32:26 UTC
verifying on subscription-manager-1.28.25-1.el8.x86_64

Beaker Test information:
                         HOSTNAME=ibm-x3650m4-01-vm-05.ibm2.lab.eng.bos.redhat.com
                            JOBID=6180347
                         RECIPEID=11270693
                    RESULT_SERVER=
                           DISTRO=RHEL-8.6.0-20220110.3
                     ARCHITECTURE=x86_64


[root@ibm-x3650m4-01-vm-05 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 3.2.21-1
subscription management rules: 5.41
subscription-manager: 1.28.25-1.el8
[root@ibm-x3650m4-01-vm-05 ~]#
[root@ibm-x3650m4-01-vm-05 ~]# rpm -qa --changelog subscription-manager | grep 2037902
- 2037902: consider user-specified --org in any case (ptoscano)     ^.....bug duplicate
[root@ibm-x3650m4-01-vm-05 ~]# 

[root@ibm-x3650m4-01-vm-05 ~]# 
[root@ibm-x3650m4-01-vm-05 ~]# subscription-manager syspurpose service-level --list --username rhel9GA --password ****** --org=foo
Organization with id foo could not be found. (HTTP error code 404: Not Found)
[root@ibm-x3650m4-01-vm-05 ~]# 
[root@ibm-x3650m4-01-vm-05 ~]# subscription-manager syspurpose role --list --username rhel9GA --password ****** --org=foo
Organization with id foo could not be found. (HTTP error code 404: Not Found)
[root@ibm-x3650m4-01-vm-05 ~]# 
[root@ibm-x3650m4-01-vm-05 ~]# subscription-manager syspurpose usage --list --username rhel9GA --password ****** --org=foo
Organization with id foo could not be found. (HTTP error code 404: Not Found)
[root@ibm-x3650m4-01-vm-05 ~]# 
[root@ibm-x3650m4-01-vm-05 ~]# subscription-manager syspurpose addons --list --username rhel9GA --password ****** --org=foo
Organization with id foo could not be found. (HTTP error code 404: Not Found)
[root@ibm-x3650m4-01-vm-05 ~]# 
[root@ibm-x3650m4-01-vm-05 ~]# subscription-manager service-level --list --username rhel9GA --password ****** --org=foo
Organization with id foo could not be found. (HTTP error code 404: Not Found)
[root@ibm-x3650m4-01-vm-05 ~]# 
[root@ibm-x3650m4-01-vm-05 ~]# subscription-manager role --list --username rhel9GA --password ****** --org=foo
Organization with id foo could not be found. (HTTP error code 404: Not Found)
[root@ibm-x3650m4-01-vm-05 ~]# 
[root@ibm-x3650m4-01-vm-05 ~]# subscription-manager usage --list --username rhel9GA --password ****** --org=foo
Organization with id foo could not be found. (HTTP error code 404: Not Found)
[root@ibm-x3650m4-01-vm-05 ~]# 
[root@ibm-x3650m4-01-vm-05 ~]# subscription-manager addons --list --username rhel9GA --password ****** --org=foo
Organization with id foo could not be found. (HTTP error code 404: Not Found)
[root@ibm-x3650m4-01-vm-05 ~]# 

user specified org value considered and all the syspurpose modules(role/usage/service-level/addons) now failing with consistent error message for incorrect org value.

Comment 7 errata-xmlrpc 2022-05-10 15:22:58 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 (subscription-manager 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/RHBA-2022:2047