Bug 866579 - rhn-migrate-classic-to-rhsm leaves system unregistered when a non-existant environment is specified/mistyped
rhn-migrate-classic-to-rhsm leaves system unregistered when a non-existant en...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: subscription-manager (Show other bugs)
5.9
Unspecified Unspecified
unspecified Severity high
: rc
: 5.9
Assigned To: candlepin-bugs
IDM QE LIST
:
Depends On:
Blocks: 771748 875153
  Show dependency treegraph
 
Reported: 2012-10-15 12:21 EDT by John Sefler
Modified: 2013-01-07 23:04 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
No documentation needed.
Story Points: ---
Clone Of:
: 875153 (view as bug list)
Environment:
Last Closed: 2013-01-07 23:04:23 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 John Sefler 2012-10-15 12:21:49 EDT
Description of problem:
During the migration process from rhn to a cfse server with credentials to an org containing multiple environments, rhn-migrate-classic-to-rhsm now prompts the user for an environment (fixed in bug 863428).  However, if the user mistypes the environment, then the migration script leaves the system totally unregistered and likely incompliant.  In my opinion, the migration should check that the supplied environment is available first.  Then if not available, end the script the same way it does if the user mistypes the org leaving the user still registered classically.  This would allow the user to instinctively try rhn-migrate-classic-to-rhsm again.

Version-Release number of selected component (if applicable):
[root@jsefler-rhel59 ~]# rpm -q subscription-manager-migration
subscription-manager-migration-1.0.22-1.el5


How reproducible:


Steps to Reproduce:
[root@jsefler-rhel59 ~]# rhnreg_ks --serverUrl=https://xmlrpc.rhn.code.stage.redhat.com/XMLRPC --username=qa@redhat.com --password=*** --force --norhnsd --nohardware --nopackages --novirtinfo
[root@jsefler-rhel59 ~]# rhn-migrate-classic-to-rhsm --serverurl=se-rhelbox.usersys.redhat.com/cfse/api --no-auto
Red Hat account: qa@redhat.com
Password: 
System Engine Username: admin
Password: 
Org: Test_Org
Environment: Nonexistant_Env       

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

+-----------------------------------------------------+ 
Installing product certificates for these RHN Classic channels:
+-----------------------------------------------------+
rhel-x86_64-server-5

Product certificates installed 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 ...
No such environment: Nonexistant_Env

Unable to register.
For further assistance, please contact Red Hat Global Support Services.
[root@jsefler-rhel59 ~]# 

  
Actual results:
above


Expected results:
Something like this...
[root@jsefler-rhel59 ~]# rhn-migrate-classic-to-rhsm --serverurl=se-rhelbox.usersys.redhat.com/cfse/api --no-auto
Red Hat account: qa@redhat.com
Password: 
System Engine Username: admin
Password: 
Org: Test_Org
Environment: Nonexistant_Env 
No such environment: Nonexistant_Env
[root@jsefler-rhel59 ~]# echo $?
1
Comment 1 RHEL Product and Program Management 2012-10-15 12:29:17 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 2 Alex Wood 2012-10-16 14:37:01 EDT
commit 4ec77a8a6a04f8181da33104836ddd708fbfac7c
Author:     Alex Wood <awood@redhat.com>
AuthorDate: Sun Oct 7 11:36:01 2012 -0400
Commit:     Alex Wood <awood@redhat.com>
CommitDate: Mon Oct 15 15:36:06 2012 -0400

Available in subscription-manager-1.1.4-1+
Comment 4 John Sefler 2012-10-16 18:10:39 EDT
Verifying Version...
[root@jsefler-rhel59 ~]# rpm -q subscription-manager-migration
subscription-manager-migration-1.0.23-1.el5
CloudForms System Engine Version: 1.1.12-14.el6cf is the to-rhsm server

Setup: user registers to RHN Classic...

[root@jsefler-rhel59 ~]# subscription-manager config --server.insecure=1
[root@jsefler-rhel59 ~]# rhnreg_ks --serverUrl=https://xmlrpc.rhn.redhat.com/XMLRPC --username=qa@redhat.com --password=*** --force --norhnsd --nohardware --nopackages --novirtinfo



Case 1: user mistypes the org during migration...

[root@jsefler-rhel59 ~]# rhn-migrate-classic-to-rhsm --serverurl=se-rhelbox.usersys.redhat.com/cfse/api --no-auto
Red Hat account: qa@redhat.com
Password: 
System Engine Username: admin
Password: 
Org: Nonexistant_Org
Unable to connect to certificate server: Couldn't find organization 'Nonexistant_Org'.  See /var/log/rhsm/rhsm.log for more details.
[root@jsefler-rhel59 ~]# subscription-manager version | grep "server type"
server type: RHN Classic

^^^ VERIFIED: a mistyped org is aborted, but happily leaves the system registered to RHN Classic.



Case 2: user mistypes the env during migration...

[root@jsefler-rhel59 ~]# rhn-migrate-classic-to-rhsm --serverurl=se-rhelbox.usersys.redhat.com/cfse/api --no-auto
Red Hat account: qa@redhat.com
Password: 
System Engine Username: admin
Password: 
Org: Test_Org
Environment: Nonexistant_Env
No such environment: Nonexistant_Env
[root@jsefler-rhel59 ~]# subscription-manager version | grep "server type"
server type: RHN Classic

^^^ VERIFIED: a mistyped env is aborted, but happily leaves the system registered to RHN Classic.


Case 3: user correctly enters org and env during migration...

[root@jsefler-rhel59 ~]# rhn-migrate-classic-to-rhsm --serverurl=se-rhelbox.usersys.redhat.com/cfse/api --no-auto
Red Hat account: qa@redhat.com
Password: 
System Engine Username: admin
Password: 
Org: Test_Org
Environment: Test_Env

Retrieving existing RHN Classic subscription information ...

+-----------------------------------------------------+ 
System is currently subscribed to these RHN Classic Channels:
+-----------------------------------------------------+
rhel-x86_64-server-5

+-----------------------------------------------------+ 
Installing product certificates for these RHN Classic channels:
+-----------------------------------------------------+
rhel-x86_64-server-5

Product certificates installed 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: 809122cc-2d04-4fc7-8f43-eb525d59ad74 
System 'jsefler-rhel59.usersys.redhat.com' successfully registered to Red Hat Subscription Management.

[root@jsefler-rhel59 ~]# subscription-manager version | grep "server type"server type: subscription management service
[root@jsefler-rhel59 ~]# 

^^^ VERIFIED: a system can successfully migrate to a cfse server with credentials to a specific org and a specific environment.  The registration to RHN Classic is replaced by a registration to a subscription management service.
Comment 6 errata-xmlrpc 2013-01-07 23:04:23 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.