Bug 2003777
| Summary: | Show available orgs before prompting for input in syspurpose subcommands | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | mhorky | |
| Component: | subscription-manager | Assignee: | mhorky | |
| Status: | CLOSED ERRATA | QA Contact: | Red Hat subscription-manager QE Team <rhsm-qe> | |
| Severity: | low | Docs Contact: | ||
| Priority: | medium | |||
| Version: | unspecified | CC: | csnyder, jhnidek, jsefler, redakkan | |
| Target Milestone: | rc | Keywords: | Triaged | |
| Target Release: | 9.0 | Flags: | pm-rhel:
mirror+
|
|
| Hardware: | Unspecified | |||
| OS: | Unspecified | |||
| Whiteboard: | ||||
| Fixed In Version: | subscription-manager-1.29.21-1.el9 | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 2037901 (view as bug list) | Environment: | ||
| Last Closed: | 2022-05-17 15:58:12 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: | 2037901 | |||
|
Description
mhorky
2021-09-13 16:54:37 UTC
Hint: the list of available organization printed during registration was implemented in this PR: https://github.com/candlepin/subscription-manager/pull/2221 Pretesting...
[root@kvm-02-guest23 ~]# rpm -q subscription-manager
subscription-manager-1.29.19-1.git.24.e45b1f2.el9.x86_64
[root@kvm-02-guest23 ~]#
[root@kvm-02-guest23 ~]# rpm -q subscription-manager --changelog | grep 2003777
- 2003777: Show available organizations before asking for input
_____________________________________________
SCENARIO 1:
[root@kvm-02-guest23 ~]# subscription-manager syspurpose role --list --username=testuser1 --org=admin
Password:
Hint: User "testuser1" is member of following organizations: snowwhite, admin
+-------------------------------------------+
Available role
+-------------------------------------------+
- SP Starter
- SP Server
[root@kvm-02-guest23 ~]#
FAILEDQA: I correctly passed a valid org. The Hint should have been suppressed.
When a valid org is passed through the options and the username/password/org resolve to one possible consumer, then there is no need for the Hint.
_____________________________________________
SCENARIO 2:
[root@kvm-02-guest23 ~]# subscription-manager syspurpose role --list --username=testuser1 --org=INVALID
Password:
Hint: User "testuser1" is member of following organizations: snowwhite, admin
Organization with id INVALID could not be found. (HTTP error code 404: Not Found)
[root@kvm-02-guest23 ~]#
FAILEDQA: I passed a value for org and the Hint is too late.
__________________________________________________________________________________
__________________________________________________________________________________
In my opinion, the Hint should only be presented prior to an interactive org prompting (when multiple orgs are possible).
My suggested behavior will the behavior from other modules (e.g. register) that also present a Hint for org when necessary. For example:
[root@kvm-02-guest23 ~]# subscription-manager register --username=testuser1 --org=admin
Registering to: rhsm-auto90-candlepin.usersys.redhat.com:8443/candlepin
Password:
The system has been registered with ID: 8c86b480-edb8-4fef-87dd-84471df63356
The registered system name is: kvm-02-guest23.hv2.lab.eng.bos.redhat.com
[root@kvm-02-guest23 ~]#
^^^^ NOTICE NO HINT
[root@kvm-02-guest23 ~]# subscription-manager register --username=testuser1 --org=INVALID
Registering to: rhsm-auto90-candlepin.usersys.redhat.com:8443/candlepin
Password:
Invalid Credentials (HTTP error code 401: Unauthorized)
[root@kvm-02-guest23 ~]#
^^^^ NOTICE NO HINT
[root@kvm-02-guest23 ~]# subscription-manager register --username=testuser1
Registering to: rhsm-auto90-candlepin.usersys.redhat.com:8443/candlepin
Password:
Hint: User "testuser1" is member of following organizations: snowwhite, admin
Organization: admin
The system has been registered with ID: 9c2a0380-b786-4f15-ad09-791c87094ec6
The registered system name is: kvm-02-guest23.hv2.lab.eng.bos.redhat.com
[root@kvm-02-guest23 ~]#
^^^^ NOTICE THE HINT IS ONLY PRESENTED PRIOR TO AN INTERACTIVE PROMPTING FOR AN ORG.
Pretesting... [root@rhsm-auto90-client1 ~]# rpm -q subscription-manager subscription-manager-1.29.19-1.git.26.ab76b02.el9.x86_64 This build includes "2003777: Only hint organizations if it's needed" main commit ab76b029d9cad5fdff8c36f68b9e6517b9033e19 [root@rhsm-auto90-client1 ~]# subscription-manager role --list --username=testuser1 --password=password --org=admin Organization with id None could not be found. (HTTP error code 404: Not Found) <=========== DID NOT EXPECT THIS [root@rhsm-auto90-client1 ~]# [root@rhsm-auto90-client1 ~]# tail -f /var/log/rhsm/rhsm.log 2021-10-11 12:39:27,057 [DEBUG] subscription-manager:2666183:MainThread @cli.py:189 - Consumer Identity name=None uuid=None 2021-10-11 12:39:27,057 [DEBUG] subscription-manager:2666183:MainThread @connection.py:717 - Making request: GET /candlepin/users/testuser1/owners 2021-10-11 12:39:27,065 [DEBUG] subscription-manager:2666183:MainThread @connection.py:571 - Loaded CA certificates from /etc/rhsm/ca/: rhsm-auto90-candlepin.pem, timeout_listener.pem, redhat-entitlement-authority.pem, redhat-uep.pem 2021-10-11 12:39:27,109 [DEBUG] subscription-manager:2666183:MainThread @connection.py:810 - Response time: 0.015153884887695312, Smoothed response time: 0.015153884887695312 2021-10-11 12:39:27,109 [DEBUG] subscription-manager:2666183:MainThread @connection.py:787 - Response: status=200, requestUuid=0d6bee8c-05d5-4e13-acb9-a6feb51ff8b3, request="GET /candlepin/users/testuser1/owners" 2021-10-11 12:39:27,111 [DEBUG] subscription-manager:2666183:MainThread @connection.py:717 - Making request: GET /candlepin/owners/None/system_purpose 2021-10-11 12:39:27,117 [DEBUG] subscription-manager:2666183:MainThread @connection.py:571 - Loaded CA certificates from /etc/rhsm/ca/: rhsm-auto90-candlepin.pem, timeout_listener.pem, redhat-entitlement-authority.pem, redhat-uep.pem 2021-10-11 12:39:27,149 [DEBUG] subscription-manager:2666183:MainThread @connection.py:810 - Response time: 0.010170459747314453, Smoothed response time: 0.014655542373657227 2021-10-11 12:39:27,149 [DEBUG] subscription-manager:2666183:MainThread @connection.py:787 - Response: status=404, requestUuid=4f4ae156-58a7-4a5f-85a3-3360b384356b, request="GET /candlepin/owners/None/system_purpose" 2021-10-11 12:39:27,150 [WARNING] subscription-manager:2666183:MainThread @abstract_syspurpose.py:190 - Unable to get list of valid fields using REST API: HTTP error (404 - Not Found): Organization with id None could not be found. FailedQA: There appears to be an exception handling problem when making this call from an unregistered state. In the comment above, I should have noted that the response is the same with|without making the call from the syspurpose subcommand... [root@rhsm-auto90-client1 ~]# subscription-manager role --list --username=testuser1 --password=password --org=admin Organization with id None could not be found. (HTTP error code 404: Not Found) [root@rhsm-auto90-client1 ~]# subscription-manager syspurpose role --list --username=testuser1 --password=password --org=admin Organization with id None could not be found. (HTTP error code 404: Not Found) [root@rhsm-auto90-client1 ~]# Pretesting after applying all three pull requests... https://github.com/candlepin/subscription-manager/pull/2796 https://github.com/candlepin/subscription-manager/pull/2819 https://github.com/candlepin/subscription-manager/pull/2850 [root@kvm-04-guest08 ~]# rpm -q subscription-manager subscription-manager-1.29.19-1.git.119.033bf98.el9.x86_64 [root@kvm-04-guest08 ~]# subscription-manager syspurpose role --list --username=testuser1 --org=admin Error: you must register or specify --username and --password to list role [root@kvm-04-guest08 ~]# subscription-manager syspurpose role --list --username=testuser1 --org=admin --password=password +-------------------------------------------+ Available role +-------------------------------------------+ - SP Starter - SP Server [root@kvm-04-guest08 ~]# subscription-manager syspurpose role --list --username=testuser1 --org=INVALID Error: you must register or specify --username and --password to list role [root@kvm-04-guest08 ~]# subscription-manager syspurpose role --list --username=testuser1 --org=INVALID --password=password Organization with id INVALID could not be found. (HTTP error code 404: Not Found) [root@kvm-04-guest08 ~]# subscription-manager role --list --username=testuser1 --password=password Hint: User "testuser1" is member of following organizations: snowwhite, admin <============ PASSED Organization: INVALID Organization with id INVALID could not be found. (HTTP error code 404: Not Found) [root@kvm-04-guest08 ~]# subscription-manager role --list --username=testuser1 --password=password Hint: User "testuser1" is member of following organizations: snowwhite, admin <============ PASSED Organization: admin +-------------------------------------------+ Available role +-------------------------------------------+ - SP Starter - SP Server [root@kvm-04-guest08 ~]# subscription-manager orgs --username=mickey --password=password +-------------------------------------------+ mickey Organizations +-------------------------------------------+ Name: Donald Duck Key: donaldduck [root@kvm-04-guest08 ~]# subscription-manager role --list --username=mickey --password=password +-------------------------------------------+ Available role +-------------------------------------------+ - SP Starter - SP Server Verified:Tested syspurpose shows available orgs (when needed) before prompting for an org 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 (new packages: subscription-manager), 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:3984 |