Bug 840169

Summary: rhn-migrate-classic-to-rhsm appears to autosubscribe before considering the requested --servicelevel option
Product: Red Hat Enterprise Linux 5 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Alex Wood <awood>
Status: CLOSED ERRATA QA Contact: Entitlement Bugs <entitlement-bugs>
Severity: high Docs Contact:
Priority: unspecified    
Version: 5.9CC: bkearney, fsharath, skallesh, spandey
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Attempting to migrate a system from RHN to Red Hat Subscription Management using the rhn-migrate-classic-to-rhsm tool. Consequence: The system is registered but does not have its service level set correctly. Fix: The service level is now set before registration, Result: The service level is taken into account when a system registers.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-08 03:57:09 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 John Sefler 2012-07-14 02:59:42 UTC
Description of problem:
As demonstrated in the reproduction steps below, the autosubscribe step appears to happen before considration of the --servicelevel option.

Version-Release number of selected component (if applicable):
[root@ibm-x3620m3-01 ~]# rpm -q subscription-manager
subscription-manager-1.0.9-1.el5


How reproducible:


Steps to Reproduce:

[root@ibm-x3620m3-01 ~]# subscription-manager list --installed --consumed
No installed products to list
[root@ibm-x3620m3-01 ~]# rhn-migrate-classic-to-rhsm -f --servicelevel=PrEMiuM
RHN Username: qa
Password: 

Retrieving existing RHN Classic subscription information ...
+----------------------------------+
System is currently subscribed to:
+----------------------------------+
rhel-x86_64-server-5
rhn-tools-rhel-x86_64-server-5
rhel-x86_64-server-rhsclient-5-debuginfo
rhel-x86_64-server-rhsclient-5

+--------------------------------------------------+ 
Unrecognized channels. Channel to product certificate mapping missing for these channels.
+--------------------------------------------------+
rhn-tools-rhel-x86_64-server-5
rhel-x86_64-server-rhsclient-5-debuginfo
rhel-x86_64-server-rhsclient-5

List of channels for which certs are being copied
rhel-x86_64-server-5

Product certificates copied successfully to /etc/pki/product

Preparing to unregister system from RHN classic ...
System successfully unregistered from RHN Classic.

Attempting to register system to Certificate-based RHN ...
The system has been registered with id: fcaaf00c-b14c-47b2-9c57-1073e7a79a60 
System 'ibm-x3620m3-01.rhts.eng.bos.redhat.com' successfully registered to Certificate-based RHN.

Attempting to auto-subscribe to appropriate subscriptions ...
Installed Product Current Status:
Product Name:         	Red Hat Enterprise Linux Server
Status:               	Subscribed


Please visit https://access.redhat.com/management/consumers/fcaaf00c-b14c-47b2-9c57-1073e7a79a60 to view the details, and to make changes if necessary.

Service level "PrEMiuM" is not available.
Please select a service level agreement for this system.
1. Standard
2. Layered
3. Self-support
4. None
5. Premium
6. No service level preference
? 5

Subscribing to service level Premium
[root@ibm-x3620m3-01 ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+

Subscription Name:    	CloudForms Beta
Provides:             	Red Hat CloudForms
                      	Red Hat Enterprise Linux Server
SKU:                  	MCT2538
Contract:             	3060009
Account:              	477931
Serial Number:        	3146900506500318348
Active:               	True
Quantity Used:        	1
Service Level:        	Standard
Service Type:         	L1-L3
Starts:               	05/23/2012
Ends:                 	07/21/2012

[root@ibm-x3620m3-01 ~]# 



NOTICE IN THE STEPS ABOVE, I REQUESTED A --servicelevel=PrEMiuM.  HOWEVER, THE MIGRATED PRODUCT CERT APPEARS TO BE AUTOSUBSCRIBED FOLLOWED BY "Service level "PrEMiuM" is not available.".  THEN I RESPOND TO THE INTERACTIVE PROMPT FOR "Premium", BUT IN THE END, I HAVE AUTO COSUMED A "Standard" SERVICE LEVEL.   THE ORDER OF EVENTS APPEARS OUT OF ORDER.

Comment 1 RHEL Program Management 2012-07-14 03:07:19 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 John Sefler 2012-07-14 04:07:36 UTC
Since subscription-manager already permits the user to specify a case-insensitive servicelevel value, rhn-migrate-classic-to-rhsm should also be able to resolve the servicelevel option regardless of case.

Comment 3 Alex Wood 2012-07-18 15:00:35 UTC
commit 7b4ba0c80f9e87b89fc6520b187c734cbd80732a
Refs: <origin/awood/840169>, awood/840169, subscription-manager-1.0.9-1-24-g7b~
Author:     Alex Wood <awood>
AuthorDate: Tue Jul 17 14:14:16 2012 -0400
Commit:     Alex Wood <awood>
CommitDate: Tue Jul 17 14:15:53 2012 -0400

Available in subscription-manager-1.0.10+

Comment 4 John Sefler 2012-07-20 18:34:42 UTC
(In reply to comment #2)
> Since subscription-manager already permits the user to specify a
> case-insensitive servicelevel value, rhn-migrate-classic-to-rhsm should also
> be able to resolve the servicelevel option regardless of case.

Opened under seperate bug 841961 - rhsm-migrate-classic-to-rhsm --servicelevel should be case insensitive

Comment 6 Sharath Dwaral 2012-08-01 15:16:11 UTC
Verification blocked by  Bug 845043

Comment 7 John Sefler 2012-08-24 21:13:00 UTC
Verifying Version...

[root@jsefler-rhel59 ~]# rpm -q subscription-manager-migration
subscription-manager-migration-1.0.14-1.el5


[root@jsefler-rhel59 ~]# rhnreg_ks --serverUrl=https://xmlrpc.rhn.code.stage.redhat.com/XMLRPC --username=qa --password=***** --profilename=rhsm-automation.jsefler-rhel59.usersys.redhat.com --force --norhnsd --nohardware --nopackages --novirtinfo
[root@jsefler-rhel59 ~]# rhn-migrate-classic-to-rhsm -f --servicelevel=PrEMiuM
Red Hat account: qa
Password: 

Retrieving existing RHN Classic subscription information ...
+----------------------------------+
System is currently subscribed to:
+----------------------------------+
rhel-x86_64-server-5

List of channels for which certs are being copied
rhel-x86_64-server-5

Product certificates copied successfully to /etc/pki/product

Preparing to unregister system from RHN Classic ...
System successfully unregistered from RHN Classic.

Attempting to register system to Red Hat Subscription Management ...
The system has been registered with id: e1ce1e87-139b-4825-a902-9a5d4da4c37f 
System 'jsefler-rhel59.usersys.redhat.com' successfully registered to Red Hat Subscription Management.


Service level "PrEMiuM" is not available.
Please select a service level agreement for this system.
1. SELF-SUPPORT
2. PREMIUM
3. STANDARD
4. NONE
5. No service level preference
? 2
Attempting to auto-subscribe to appropriate subscriptions ...
Service level set to: PREMIUM
Installed Product Current Status:
Product Name:         	Red Hat Enterprise Linux Server
Status:               	Not Subscribed


Unable to auto-subscribe.  Do your existing subscriptions match the products installed on this system?

Please visit https://access.redhat.com/management/consumers/e1ce1e87-139b-4825-a902-9a5d4da4c37f to view the details, and to make changes if necessary.
[root@jsefler-rhel59 ~]# 
[root@jsefler-rhel59 ~]# subscription-manager service-level --show
Current service level: PREMIUM


^^^^ VERIFIED: In the workflow above you can see that the requested servicelevel is now acknowledged and processed prior to the attempted autosubscribe.  The selected servicelevel is in fact saved as the new consumer's preference.

Comment 8 Alex Wood 2012-09-25 17:34:58 UTC
*** Bug 834299 has been marked as a duplicate of this bug. ***

Comment 10 errata-xmlrpc 2013-01-08 03:57:09 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