This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 820294 - rhsm knows what org i want to register until i specify the environment
rhsm knows what org i want to register until i specify the environment
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: subscription-manager (Show other bugs)
5.9
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Bryan Kearney
Entitlement Bugs
:
Depends On:
Blocks: 771748
  Show dependency treegraph
 
Reported: 2012-05-09 10:32 EDT by Justin Sherrill
Modified: 2013-01-10 06:01 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-01-07 22:52:26 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Justin Sherrill 2012-05-09 10:32:32 EDT
Version-Release number of selected component (if applicable):
subscription-manager-0.96.17-1.el6.x86_64

How reproducible:
Always

Steps: 


Try to register without specifying org or environment:

[root@dhcp77-163 ~]# subscription-manager  register --force 
Username: admin
Password: 
Organization ACME_Corporation has more than one environment. Please specify target environment for system registration.

Result is that RHSM knows that i want to register to the only org available, i just need to specify an environment.


[root@dhcp77-163 ~]# subscription-manager  register --force  --environment=DEV
Error: Must specify --org to register to an environment.

As soon as I specify the environment, it needs the org!  But it didn't need the org before.  Sad face :(


Specifying the org works fine:


[root@dhcp77-163 ~]# subscription-manager  register --force  --environment=DEV  --org=ACME_Corporation
Username: admin
Password: 



If you can figure out which org i want (the only one) without specifying an environment, you should be able to figure it out when i do.
Comment 2 RHEL Product and Program Management 2012-05-10 10:17:14 EDT
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.
Comment 3 James Bowes 2012-05-28 08:11:23 EDT
Fixed in 1.0.3, a248729
Comment 4 J.C. Molet 2012-06-21 14:32:22 EDT
Testing against: 
python-rhsm-1.0.2-1.git.2.d5c3d05.el5
subscription-manager-1.0.4-1.git.1.b28337e.el5

CloudForms System Engine Version: 0.1.317-1.el6_2

=======================================================

## SHOWS THAT THERE IS ONE ORG
[root@jmolet-vm0 ~]# subscription-manager orgs
Username: testuser
Password: 
+-------------------------------------------+
          testuser Organizations
+-------------------------------------------+

Name: 	Rome
Key: 	Rome

## SHOWS THAT THERE ARE MULTIPLE ENVIRONMENTS
[root@jmolet-vm0 ~]# subscription-manager environments --org=Rome
Username: testuser
Password: 
+-------------------------------------------+
          Environments
+-------------------------------------------+
Name:                 	Development
Description:          	

Name:                 	QA
Description:          	

Name:                 	Release
Description:          	


[root@jmolet-vm0 ~]# subscription-manager register --user testuser --pass password --environment=QA
Must specify owner key to query environment by name



^^ Better error message, but still not the desired result.  Setting back to NEW
Comment 6 James Bowes 2012-07-25 10:55:22 EDT
It works for me. check it out:


[jbowes@pipboy subscription-manager]$ sudo env PYTHONPATH=../python-rhsm/src:src/ bin/subscription-manager orgs
Username: jbowes
Password: 
+-------------------------------------------+
          jbowes Organizations
+-------------------------------------------+

Name: 	jbowes
Key: 	jbowes

[jbowes@pipboy subscription-manager]$ sudo env PYTHONPATH=../python-rhsm/src:src/ bin/subscription-manager environments --org jbowes
Username: jbowes
Password: 
+-------------------------------------------+
          Environments
+-------------------------------------------+
Name:                 	dev
Description:          	

Name:                 	qa
Description:          	

[jbowes@pipboy subscription-manager]$ sudo env PYTHONPATH=../python-rhsm/src:src/ bin/subscription-manager register --user jbowes --pass jbowes --environment qa
Validation failed: Name has already been taken
[jbowes@pipboy subscription-manager]$ sudo env PYTHONPATH=../python-rhsm/src:src/ bin/subscription-manager register --user jbowes --pass jbowes --environment qa
The system has been registered with id: c204c89d-54ca-424d-ba36-2bf2bcbc3541 

any idea what might be different? otherwise, maybe you can retest. it could have been a bug in katello's returned results for org list.
Comment 8 John Sefler 2012-09-20 13:36:43 EDT
Verifying Version...
[root@rhsm-accept-rhel5 ~]# rpm -q python-rhsm subscription-manager
python-rhsm-1.0.8-1.el5
subscription-manager-1.0.18-1.el5

CloudForms System Engine Version: 1.1.12-7.el6cf 

Prep work...
Using the katello gui, user jsefler was created in single org Starbucks with access to environment Demi
Using KATELLO_HOSTNAME=qetello02.usersys.redhat.com I installed the package to install the katello ca cert and configure the rhsm.conf as instructed in comment 5



Testing with user admin who has access to multiple orgs with multiple environments...

[root@rhsm-accept-rhel5 ~]# subscription-manager register --username admin
Password: 
You have not set a default organization and environment on the user admin.
[root@rhsm-accept-rhel5 ~]# subscription-manager orgs --username admin
Password: 
+-------------------------------------------+
          admin Organizations
+-------------------------------------------+

Name: 	Starbucks
Key: 	Starbucks

Name: 	Lenovo
Key: 	Lenovo

Name: 	AlphabetSoup
Key: 	AlphabetSoup

Name: 	QE
Key: 	QE

Name: 	ACME_Corporation
Key: 	ACME_Corporation

[root@rhsm-accept-rhel5 ~]# subscription-manager register --username admin --org QE
Password: 
Organization QE has more than one environment. Please specify target environment for system registration.
[root@rhsm-accept-rhel5 ~]# subscription-manager environments --username admin --org QE
Password: 
+-------------------------------------------+
          Environments
+-------------------------------------------+
Name:                 	GA
Description:          	None

Name:                 	QE
Description:          	None

Name:                 	DEV
Description:          	None

[root@rhsm-accept-rhel5 ~]# subscription-manager register --username admin --environment GA
Password: 
Must specify owner key to query environment by name
[root@rhsm-accept-rhel5 ~]# subscription-manager register --username admin --environment GA --org QE
Password: 
The system has been registered with id: 2b2bb4df-680d-4d1b-a34a-d0ee6f4c1422 
[root@rhsm-accept-rhel5 ~]# 

^^^ ALL APPEARS TO BE PASSING



Testing with user jsefler who has access to one org and one environment...

[root@rhsm-accept-rhel5 ~]# subscription-manager register --username jsefler
Password: 
The system has been registered with id: 087b2419-51c0-4783-9a18-6757485cdd7b 
[root@rhsm-accept-rhel5 ~]# 
[root@rhsm-accept-rhel5 ~]# subscription-manager orgs --username jsefler
Password: 
+-------------------------------------------+
          jsefler Organizations
+-------------------------------------------+

Name: 	Starbucks
Key: 	Starbucks

[root@rhsm-accept-rhel5 ~]# subscription-manager environments --username jsefler
Error: This command requires that you specify an organization with --org
[root@rhsm-accept-rhel5 ~]# subscription-manager environments --username jsefler --org Starbucks
Password: 
+-------------------------------------------+
          Environments
+-------------------------------------------+
Name:                 	Venti
Description:          	None

Name:                 	Grande
Description:          	None

Name:                 	Demi
Description:          	None

[root@rhsm-accept-rhel5 ~]# 

^^^ Notice that there are three environments under org Starbucks, yet user jsefler was able to register without specifying an environment.  That was because user jsefler was only granted access to environment Demi.  Testing again...

[root@rhsm-accept-rhel5 ~]# subscription-manager unregister
System has been un-registered.
[root@rhsm-accept-rhel5 ~]# subscription-manager register --username jsefler --environment Venti
Password: 
User jsefler is not allowed to access api/systems/create
[root@rhsm-accept-rhel5 ~]# subscription-manager register --username jsefler --environment Grande
Password: 
User jsefler is not allowed to access api/systems/create
[root@rhsm-accept-rhel5 ~]# subscription-manager register --username jsefler --environment Demi
Password: 
The system has been registered with id: 6a2c2668-35c3-4de8-8809-42f95068218e 
[root@rhsm-accept-rhel5 ~]# 


^^^ ALL APPEARS TO BE PASSING

Moving to VERIFIED
Comment 10 errata-xmlrpc 2013-01-07 22:52:26 EST
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, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0033.html

Note You need to log in before you can comment on or make changes to this bug.