Bug 820294 - rhsm knows what org i want to register until i specify the environment
Summary: rhsm knows what org i want to register until i specify the environment
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: subscription-manager
Version: 5.9
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Bryan Kearney
QA Contact: Entitlement Bugs
URL:
Whiteboard:
Depends On:
Blocks: 771748
TreeView+ depends on / blocked
 
Reported: 2012-05-09 14:32 UTC by Justin Sherrill
Modified: 2013-01-10 11:01 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-01-08 03:52:26 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0033 0 normal SHIPPED_LIVE subscription-manager bug fix and enhancement update 2013-01-08 08:38:27 UTC

Description Justin Sherrill 2012-05-09 14:32:32 UTC
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 Program Management 2012-05-10 14:17:14 UTC
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 12:11:23 UTC
Fixed in 1.0.3, a248729

Comment 4 J.C. Molet 2012-06-21 18:32:22 UTC
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 14:55:22 UTC
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 17:36:43 UTC
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-08 03:52:26 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, 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.