RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1220493 - rhn-migrate-classic-to-rhsm is failing when specifying a --destination-url
Summary: rhn-migrate-classic-to-rhsm is failing when specifying a --destination-url
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager
Version: 6.7
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: rc
: ---
Assignee: Alex Wood
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks: rhsm-rhel67
TreeView+ depends on / blocked
 
Reported: 2015-05-11 16:31 UTC by John Sefler
Modified: 2015-05-15 19:06 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-05-14 20:57:51 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description John Sefler 2015-05-11 16:31:51 UTC
Description of problem:
A --destination-url is used to specify an rhsm server hostname:port/prefix on the command line.  It should be used to override the [server] hostname port and prefix configurations in rhsm.conf.  In the current rhel6.7 version of subscription-manager-migration, an exception is being thrown because the rhsm.conf file configurations are being used.  This is a regression from the prior rhel6.6 version of subscription-manager-migration.

Version-Release number of selected component (if applicable):
[root@jsefler-os6 ~]# rpm -q subscription-manager-migration
subscription-manager-migration-1.14.6-1.el6.x86_64


How reproducible:
always


Steps to Reproduce:
[root@jsefler-os6 ~]# rhnreg_ks --serverUrl=https://xmlrpc.rhn.code.stage.redhat.com/XMLRPC --username=qa --password=REDACTED --profilename=rhsm-automation.jsefler-os6 --force --norhnsd --nohardware --nopackages --novirtinfo
[root@jsefler-os6 ~]# rhn-channel --list
rhel-x86_64-server-6
[root@jsefler-os6 ~]# subscription-manager config --server.hostname=bad-hostname.com --server.port=000 --server.prefix=/bad-prefix
[root@jsefler-os6 ~]# rhn-migrate-classic-to-rhsm --destination-url=subscription.rhn.stage.redhat.com
Legacy username: qa
Legacy password: 
Destination username: stage_auto_testuser
Destination password: 
Unable to connect to certificate server: Server error attempting a GET to /bad-prefix/status returned status 404.  See /var/log/rhsm/rhsm.log for more details.
[root@jsefler-os6 ~]# 


Actual results:
above

Expected results:
successful migration to the destination rhsm server

Additional info:

[root@jsefler-os6 ~]# tail -f /var/log/rhsm/rhsm.log

2015-05-11 12:28:50,146 [INFO] rhn-migrate-classic-to-rhsm:6223 @connection.py:727 - Connection built: host=subscription.rhn.stage.redhat.com port=443 handler=/bad-prefix auth=basic username=stage_auto_testuser
2015-05-11 12:28:50,146 [DEBUG] rhn-migrate-classic-to-rhsm:6223 @identity.py:131 - Loading consumer info from identity certificates.
2015-05-11 12:28:50,147 [DEBUG] rhn-migrate-classic-to-rhsm:6223 @identity.py:143 - Reload of consumer identity cert /etc/pki/consumer/cert.pem raised an exception with msg: [Errno 2] No such file or directory: '/etc/pki/consumer/key.pem'
2015-05-11 12:28:50,152 [DEBUG] rhn-migrate-classic-to-rhsm:6223 @connection.py:446 - Loaded CA certificates from /etc/rhsm/ca/: candlepin-stage.pem, jsefler-f14-7candlepin.pem, jsefler-os-candlepin.pem, jsefler-f14-candlepin.pem, jsefler-os6candlepin.pem, redhat-uep.pem
2015-05-11 12:28:50,152 [DEBUG] rhn-migrate-classic-to-rhsm:6223 @connection.py:494 - Making request: GET /bad-prefix/status
2015-05-11 12:28:50,373 [DEBUG] rhn-migrate-classic-to-rhsm:6223 @connection.py:521 - Response: status=404
2015-05-11 12:28:50,374 [ERROR] rhn-migrate-classic-to-rhsm:6223 @connection.py:550 - Response: 404
2015-05-11 12:28:50,375 [ERROR] rhn-migrate-classic-to-rhsm:6223 @connection.py:551 - JSON parsing error: No JSON object could be decoded
2015-05-11 12:28:50,375 [ERROR] rhn-migrate-classic-to-rhsm:6223 @migrate.py:263 - Server error attempting a GET to /bad-prefix/status returned status 404
Traceback (most recent call last):
  File "/usr/share/rhsm/subscription_manager/migrate/migrate.py", line 258, in check_ok_to_proceed
    self.cp.getStatus()
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 1194, in getStatus
    return self.conn.request_get(method)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 602, in request_get
    return self._request("GET", method)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 530, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 578, in validateResponse
    handler=handler)
RemoteServerException: Server error attempting a GET to /bad-prefix/status returned status 404

Comment 3 Alex Wood 2015-05-14 19:47:31 UTC
The destination URL needs to be like so:

 --destination-url=subscription.rhn.stage.redhat.com:443/subscription

The format requirements have not changed, so I do not believe this is a regression.  Can you please test again and close this if it is not a bug?

Comment 4 John Sefler 2015-05-14 20:57:51 UTC
My apologies, I destructively configured a bad hostname, bad port, and bad prefix.  Then I neglected to include a good port and good prefix within the --destination-url.  Of course the steps in comment 0 failed.

 
Retesting....

[root@jsefler-os6 ~]# subscription-manager config --server.hostname=bad-hostname.com --server.port=000 --server.prefix=/bad-prefix
[root@jsefler-os6 ~]# rhn-migrate-classic-to-rhsm --destination-url=subscription.rhn.stage.redhat.com:443/subscription
Legacy username: qa
Legacy password: 
Destination username: stage_auto_testuser
Destination password: 

Retrieving existing legacy subscription information...

+-----------------------------------------------------+
System is currently subscribed to these legacy channels:
+-----------------------------------------------------+
rhel-x86_64-server-6

+-----------------------------------------------------+
Installing product certificates for these legacy channels:
+-----------------------------------------------------+
rhel-x86_64-server-6

Product certificates installed successfully to /etc/pki/product.

Preparing to unregister system from legacy server...
System successfully unregistered from legacy server.

Attempting to register system to destination server...
The system has been registered with ID: 82be1bc0-a06c-4b6f-92d3-710aa9cb6e2c 

Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

System 'jsefler-os6' successfully registered.

[root@jsefler-os6 ~]# 

VERIFIED: --destination-url should be of the format https://hostname:port/prefix
VERIFIED (but not shown):  --destination-url can exclude ":port" or "/prefix" when they are already configured properly in /etc/rhsm/rhsm.conf


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