Bug 2142797

Summary: It is not possible to connect RHSM, when user is member of more organizations
Product: Red Hat Enterprise Linux 9 Reporter: Jiri Hnidek <jhnidek>
Component: rhcAssignee: Jiri Hnidek <jhnidek>
Status: CLOSED ERRATA QA Contact: Pavol Kotvan <pakotvan>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.1CC: ahitacat, cmarinea, fjansen, jsefler, jstavel, pakotvan, redakkan
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: SCRUB_20221128
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-07 08:36:45 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 Jiri Hnidek 2022-11-15 10:14:45 UTC
Description of problem:
When you try to register system using rhc CLI tool, then it is not possible to register the system, when user is member of more organizations. It is not possible to specify the organization using CLI option. The rhc CLI tool do not ask for organization too.

Version-Release number of selected component (if applicable):
[root@rhel9 ~]# rhc --version
rhc version 0.2.1

How reproducible:
100%

Steps to Reproduce:
1. Create account that is member of more than one organization (I use locally deployed candlepin server with testing data)
2. Try to register system using rhc CLI tool:

[root@rhel9 ~]# rhc connect --username admin --password admin
Connecting rhel9 to Red Hat.
This might take a few seconds.

info: User admin is member of more organizations, but no organization was selected
[root@rhel9 ~]# rhc connect --username admin --password admin --organization admin
Connecting rhel9 to Red Hat.
This might take a few seconds.

error: Error: Missing username or password.


Actual results:
As you can see the current situation does not allow to register system using rhc and error messages printed to console are little bit confusing.

Expected results:
It should be possible to specify organization using CLI option --organization. When --username and --password are not specified, then rhc should not ask only for username and password, but it should also ask for organization, when user is member of more than one organization (rhc should display list of available organization)

Additional info:
This issue has been partially fixed in this PR: https://github.com/RedHatInsights/rhc/pull/20 (it is possible to specify organization using --organization CLI option)

Comment 1 Jiri Hnidek 2022-11-15 10:18:25 UTC
When username and password is not specified using CLI option, then this issue looks like this:

[root@rhel9 ~]# rhc connect
Connecting rhel9 to Red Hat.
This might take a few seconds.

Username: admin
Password: 

info: User admin is member of more organizations, but no organization was selected

As you can see rhc does not ask for organization in this case at all.

BTW: When Satellite is used for registration, then user can be also member of some environments and it is not possible to specify environments too.

Comment 2 Jan Stavel 2023-05-19 17:14:38 UTC
     Beaker Test information:
                         HOSTNAME=opicee-5.4a2m.lab.eng.bos.redhat.com
                            JOBID=7866551
                         RECIPEID=13926242
                    RESULT_SERVER=
                           DISTRO=RHEL-9.3.0-updates-20230519.d.24
                     ARCHITECTURE=x86_64

      Job Whiteboard: Reserve Workflow provision of distro None on any system for 345600 seconds

      Recipe Whiteboard: 
**  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **

[root@opicee-5 ~]# rhc connect

Connecting ..............................redhat.com to Red Hat.
This might take a few seconds.

Username: testuser1
Password: 

Available Organizations:
snowwhite  admin
Organization: snowwhite

● Connected to Red Hat Subscription Management
! Cannot connect to Red Hat Insights
● Activated the Remote Host Configuration daemon

Comment 3 Jan Stavel 2023-05-19 18:04:28 UTC
    Beaker Test information:
                         HOSTNAME=sweetpig-12.4a2m.lab.eng.bos.redhat.com
                            JOBID=7868103
                         RECIPEID=13928790
                    RESULT_SERVER=
                           DISTRO=RHEL-8.9.0-updates-20230519.d.28
                     ARCHITECTURE=x86_64

      Job Whiteboard: Reserve Workflow provision of distro None on any system for 86400 seconds

      Recipe Whiteboard: 
**  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **
[root@sweetpig-12 ~]# rhc connect
Connecting sweetpig-12.4a2m.lab.eng.bos.redhat.com to Red Hat.
This might take a few seconds.

Username: testuser1
Password: 

Available Organizations:
snowwhite  admin
Organization: snowwhite

● Connected to Red Hat Subscription Management
! Cannot connect to Red Hat Insights
● Activated the Remote Host Configuration daemon

Manage your connected systems: https://red.ht/connector

Comment 6 errata-xmlrpc 2023-11-07 08:36:45 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 (rhc 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-2023:6541