Bug 1859157
| Summary: | Change the dispalyed message when user tries to list available roles and usage for an invalid org | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Shwetha Kallesh <skallesh> | |
| Component: | subscription-manager | Assignee: | mhorky | |
| Status: | CLOSED ERRATA | QA Contact: | Red Hat subscription-manager QE Team <rhsm-qe> | |
| Severity: | medium | Docs Contact: | ||
| Priority: | medium | |||
| Version: | 8.3 | CC: | jsefler, mhorky, redakkan | |
| Target Milestone: | rc | Keywords: | Triaged | |
| Target Release: | 8.3 | Flags: | pm-rhel:
mirror+
|
|
| Hardware: | Unspecified | |||
| OS: | Unspecified | |||
| Whiteboard: | ||||
| Fixed In Version: | subscription-manager-1.28.24-1.el8 | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 2022786 (view as bug list) | Environment: | ||
| Last Closed: | 2022-05-10 15:22:56 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: | 2022786 | |||
|
Description
Shwetha Kallesh
2020-07-21 11:11:13 UTC
Also exit code is 0 , even though it was an unsuccessful execution [root@kvm-06-guest04 ~]# echo $? 0 [root@kvm-07-guest02 ~]# subscription-manager role --list --username stage_auto_testuserdsadsa --password redhats Organization: 12814047 Unable to get list of valid values for "role" ^^ can we be more specific about the reason for not listing roles like "Invalid User credentials" [root@kvm-07-guest02 ~]# echo $? 0 ^^ Also exit code is zero on a unsuccessful transaction here Update: The actual response has changed a little due to bug 1973731... [root@kvm-07-guest20 ~]# rpm -q subscription-manager subscription-manager-1.28.19-1.el8.x86_64 [root@kvm-07-guest20 ~]# rpm -q subscription-manager --changelog | grep 1973731 - 1973731: fix wording on error when listing syspurpose values [root@kvm-07-guest20 ~]# subscription-manager usage --list --username stage_auto_syspurpose001 --password redhat --org=adsad Unable to get the list of valid values for the system purpose "usage". [root@kvm-07-guest20 ~]# echo $? 0 [root@kvm-07-guest20 ~]# subscription-manager role --list --username stage_auto_syspurpose001 --password redhat --org=adsad Unable to get the list of valid values for the system purpose "role". [root@kvm-07-guest20 ~]# echo $? 0 [root@kvm-07-guest20 ~]# subscription-manager addons --list --username stage_auto_syspurpose001 --password redhat --org=adsad Unable to get the list of valid values for the system purpose "addons". [root@kvm-07-guest20 ~]# echo $? 0 Also be aware that the argument for an org is not even processed when the username/password does not exist for any org. In the cases above, we are unable to retrieve values because the username/password are invalid and the org value is irrelevant. When a valid username/password that belongs to one org is supplied, then we get results regardless of an org option (because the org is not needed) as shown here .... [root@kvm-07-guest20 ~]# subscription-manager usage --list --username stage_rhsmqe_syspurposeuser01 --password REDACTED +-------------------------------------------+ Available usage +-------------------------------------------+ - Development/Test - Production - Disaster Recovery [root@kvm-07-guest20 ~]# subscription-manager usage --list --username stage_rhsmqe_syspurposeuser01 --password REDACTED --org adsad +-------------------------------------------+ Available usage +-------------------------------------------+ - Development/Test - Production - Disaster Recovery After the latest changes related to syspurpose commands (i.e. https://github.com/candlepin/subscription-manager/pull/2781 ), there were the following changes: (In reply to Shwetha Kallesh from comment #0) > [root@kvm-06-guest04 ~]# subscription-manager usage --list --username stage_auto_syspurpose001 --password redhat --org=adsad > Unable to get list of valid values for "usage" This failed already when querying the server for the list of available values; rather than saying only that, now there is the actual error message (usually from candlepin), formatted in the same way as in other flows/commands. For example, for an invalid username and/or password, there will be an error message mentioning invalid credentials. (In reply to Shwetha Kallesh from comment #1) > Also exit code is 0 , even though it was an unsuccessful execution > > [root@kvm-06-guest04 ~]# echo $? > 0 This is fixed too: since the situation is an error, there will be a non-zero exit code. Verifying the fix on :
======================
# 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
# rpm -qa --changelog subscription-manager | grep 1859157
- [1.28] 1859157: Display better error message on incorrect --org
1. When user belong to multiple org with valid credentials and invalid org is given
===================================================================================
Demonstrating with test data
User "testuser1" belongs to two org as shown below
# subscription-manager orgs
Username: testuser1
Password:
+-------------------------------------------+
testuser1 Organizations
+-------------------------------------------+
Name: Admin Owner
Key: admin
Name: Snow White
Key: snowwhite
# subscription-manager usage --list --username testuser1 --password=**** --org=donaldduck
Organization with id donaldduck could not be found. (HTTP error code 404: Not Found)
# echo $?
70
# subscription-manager role --list --username testuser1 --password=***** --org=donaldduck
Organization with id donaldduck could not be found. (HTTP error code 404: Not Found)
# echo $?
70
# subscription-manager addons --list --username testuser1 --password=***** --org=donaldduck
Organization with id donaldduck could not be found. (HTTP error code 404: Not Found)
# echo $?
70
# subscription-manager service-level --list --username testuser1 --password=***** --org=donaldduck
Organization with id donaldduck could not be found. (HTTP error code 404: Not Found)
# echo $?
65
Notice the error message and exit codes have been fixed
2 When user belong to multiple org with invalid credentials and invalid org is given
===================================================================================
# subscription-manager role --list --username testuser1 --password=password111 --org=donaldduck
Invalid Credentials (HTTP error code 401: Unauthorized)
# echo $?
70
# subscription-manager usage --list --username testuser1 --password=password111 --org=donaldduck
Invalid Credentials (HTTP error code 401: Unauthorized)
# echo $?
70
# subscription-manager addons --list --username testuser1 --password=password111 --org=donaldduck
Invalid Credentials (HTTP error code 401: Unauthorized)
# echo $?
70
# subscription-manager service-level --list --username testuser1 --password=password111 --org=donaldduck
Invalid Credentials (HTTP error code 401: Unauthorized)
# echo $?
70
Notice the error message and exit codes have been fixed
3. When the user belong to single org ; valid credentials with invalid org
=======================================================
# subscription-manager role --list --username=rhsm_nonsca_1 --password=***** --org=foo
+-------------------------------------------+
Available role
+-------------------------------------------+
- Red Hat Enterprise Linux Server
# 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 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
# 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
To make the behaviour a new bug has been reported Bug 2026013
4. When the user belong to single org ; invalid credentials with invalid org
=======================================================
# subscription-manager usage --list --username stage_auto_syspurpose --password redhat --org=adsad
Invalid username or password. To create a login, please visit https://www.redhat.com/wapps/ugc/register.html (HTTP error code 401: Unauthorized)
# echo $?
70
# subscription-manager role --list --username stage_auto_syspurpose --password redhat --org=adsad
Invalid username or password. To create a login, please visit https://www.redhat.com/wapps/ugc/register.html (HTTP error code 401: Unauthorized)
# echo $?
70
# subscription-manager service-level --list --username stage_auto_syspurpose --password redhat --org=adsad
Invalid username or password. To create a login, please visit https://www.redhat.com/wapps/ugc/register.html (HTTP error code 401: Unauthorized)
# echo $?
70
# subscription-manager addons --list --username stage_auto_syspurpose --password redhat --org=adsad
Invalid username or password. To create a login, please visit https://www.redhat.com/wapps/ugc/register.html (HTTP error code 401: Unauthorized)
# echo $?
70
Notice the error message and exit codes have been fixed; Based on the above observation moving the bug to verified!!
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 |