Bug 819665

Summary: Add a status check api to tell a user where they are registered (Classic v. Cert-based)
Product: Red Hat Enterprise Linux 5 Reporter: Amanda Carter <acarter>
Component: subscription-managerAssignee: Chris Duryee <cduryee>
Status: CLOSED ERRATA QA Contact: Entitlement Bugs <entitlement-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 5.9CC: awood, bkearney, cduryee, dgoodwin, jmolet
Target Milestone: rc   
Target Release: 5.9   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
No documentation needed.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-08 03:52:22 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: 771748    

Description Amanda Carter 2012-05-07 21:49:36 UTC
Feedback from tech talk prior to RHEL 6.3:

As users are migrating from one system to another, it may be difficult to know where you are registered from the machine itself. Request was provided to add a call in subscription manager that tells the user where they are registered: Classic or Cert-based RHN.

If this could be extended to recognize SAM, CloudForms, etc all the better. Thoughts?

Comment 1 RHEL Program Management 2012-05-14 20:17:33 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 2 Devan Goodwin 2012-05-30 18:32:26 UTC
Decision to add user stories to backlog and postpone this work. The plan from email discussion is as follows:

In "subscription-manager identity" CLI command, when not registered, we will check for RHN classic registration, and instead print:

"This system is registered with RHN Classic." 

In the "subscription-manager version" command, we will print the hostname we are registered to, and the type of service we are registered against. The /status JSON can be used, as the version returned here should have a prefix indicating the type of server. (i.e. katello/x.y.z)

Comment 3 Chris Duryee 2012-06-11 18:04:44 UTC
Slight alteration to comment #2, it is possible (though rare and not recommended) for a user to be registered to classic and cert-based rhn at the same time.

Instead of bailing out when user is detected as being on RHN Classic, we can print the message but continue as normal.

Comment 4 Chris Duryee 2012-06-12 14:19:25 UTC
QE note: after discussion w/ acarter, I changed the behavior from what I put in comment #3. If the user is *only* subscribed to classic, a message is displayed and the identity info is not displayed. If the user is subscribed to *both* classic and cert-based, they'll get a message that being subscribed to both is not recommended in most cases, along with a link, similar to the message displayed when a user starts sub-mgr while they are subscribed to classic. They will also see their identity info in this case.

da029ad7 master 1.0.4+

Comment 5 J.C. Molet 2012-06-19 15:15:00 UTC
[root@jmolet-vm0 rhsm]# rhsm-version 
subscription-manager-firstboot-1.0.4-1.git.3.1768f90.el5
python-rhsm-1.0.2-1.git.1.4659671.el5
subscription-manager-1.0.4-1.git.3.1768f90.el5
subscription-manager-migration-data-1.11.1.1-1.git.2.c7fbafe.el5
subscription-manager-gui-1.0.4-1.git.3.1768f90.el5
subscription-manager-migration-1.0.4-1.git.3.1768f90.el5

## Case 1: not registered to anything:

[root@jmolet-vm0 rhsm]# ls /etc/sysconfig/rhn | grep systemid
[root@jmolet-vm0 rhsm]# subscription-manager identity
This system is not yet registered. Try 'subscription-manager register --help' for more information.

## Case 2: registered to classic only:


[root@jmolet-vm0 rhsm]# cp ~/systemid /etc/sysconfig/rhn/
[root@jmolet-vm0 rhsm]# ls /etc/sysconfig/rhn | grep systemid
systemid

[root@jmolet-vm0 rhsm]# subscription-manager identity
This system is registered to RHN Classic



## Case 3: registered to both


[root@jmolet-vm0 rhsm]# subscription-manager register --user testuser1 --pass password --org admin
WARNING

This system has already been registered with RHN using RHN Classic technology.

The tool you are using is attempting to re-register using Red Hat Subscription Management technology. Red Hat recommends (except in a few cases) that customers only register once.

To learn more about RHN registration and technologies please consult this Knowledge Base Article: https://access.redhat.com/kb/docs/DOC-45563
The system has been registered with id: 7eaa291c-5460-4d2d-bd77-a61d4e19985a 


[root@jmolet-vm0 rhsm]# subscription-manager identity
This system is registered using both RHN Classic technology and RHN Certificate-Based technology.

Red Hat recommends (except in a few cases) that customers only register with RHN via one method.

To learn more about RHN registration and technologies please consult this Knowledge Base Article: https://access.redhat.com/kb/docs/DOC-45563
Current identity is: 7eaa291c-5460-4d2d-bd77-a61d4e19985a
name: jmolet-vm0.usersys.redhat.com
org name: Admin Owner
org id: 8a90f88f3803c604013803c61aa20002


### Case 4: registered using rhsm

[root@jmolet-vm0 rhsm]# rm /etc/sysconfig/rhn/systemid 
rm: remove regular file `/etc/sysconfig/rhn/systemid'? y
[root@jmolet-vm0 rhsm]# subscription-manager identity
Current identity is: 7eaa291c-5460-4d2d-bd77-a61d4e19985a
name: jmolet-vm0.usersys.redhat.com
org name: Admin Owner
org id: 8a90f88f3803c604013803c61aa2000

Comment 6 J.C. Molet 2012-06-19 15:22:00 UTC
This all looks good.  Marking VERIFIED.

Comment 8 errata-xmlrpc 2013-01-08 03:52:22 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