Bug 972883 - rhn-migrate-classic-to-rhsm tool neglects to populate /var/lib/rhsm/productid.js
rhn-migrate-classic-to-rhsm tool neglects to populate /var/lib/rhsm/productid.js
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager (Show other bugs)
6.5
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: candlepin-bugs
IDM QE LIST
:
Depends On:
Blocks: rhsm-rhel65
  Show dependency treegraph
 
Reported: 2013-06-10 14:00 EDT by John Sefler
Modified: 2013-11-21 16:26 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
No description necessary.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-11-21 16:26: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 2013-06-10 14:00:57 EDT
Description of problem:
As part of the rhn-migrate-classic-to-rhsm script procedure all the RHN Channels that the classically registered system is consuming are gathered, and then the script uses the information in /usr/share/rhsm/product/RHEL-6/channel-cert-mapping.txt to copy the product certs that correspond to the consumed RHN Channels into the /etc/pki/product cert directory.

The problem is that there is also a /var/lib/rhsm/productid.js file that keeps track of of all the repos that have possibly provided the installed product certs.  This information is used by the yum product-id plugin to determine when the final package from an entitled repo has been removed.  If there are no longer any packages installed from the entitled repo then the product id is removed (applies to non rhel* repos) because the product is no longer considered to be installed.

The consequence of the current implementation (where rhn-migrate-classic-to-rhsm neglects to poulate /var/lib/rhsm/productid.js) is this:
 - once a package is yum installed on a system from a post migrated certificate based entitlement, the productid.js will get newly populated with a single entry for the new CDN channel that provides the installed product cert - (this is good, however)
 - then if the package is yum removed and the CDN repo name does not exactly match the classic RHN channel name, then the product-id plugin will think that it is the final installed package from the CDN repo and remove the product cert.

Bottom line: there is no acknowledgment of packages that were previously installed while consuming the classic RHN channel which means that product certs installed by rhn-migrate-classic-to-rhsm script could get prematurely removed by the product-id yum plugin during yum removal transactions which consuming certificate based entitlements.
Comment 3 Alex Wood 2013-06-24 15:38:17 EDT
commit cae768ae42963bf0d9c598cf81cefa92360166ff
Author: Alex Wood <awood@redhat.com>
Date:   Thu Jun 13 10:59:55 2013 -0400

    972883: Add entries to productid.js during migration.
Comment 7 Bryan Kearney 2013-06-27 11:39:11 EDT
All modifeid bugs are in a build now. MOving to ON_QA
Comment 8 John Sefler 2013-07-17 11:19:27 EDT
Verifying Version....
[root@jsefler-5 ~]# rpm -q subscription-manager-migration
subscription-manager-migration-1.8.13-1.el5

[root@jsefler-5 ~]# rhnreg_ks --serverUrl=https://xmlrpc.rhn.code.stage.redhat.com/XMLRPC --username=qa@redhat.com --password=****** --force --norhnsd --nohardware --nopackages --novirtinfo

[root@jsefler-5 ~]# rhn-channel --add -c rhel-x86_64-server-eucjp-5 -c rhel-x86_64-server-dts-5 -c rhel-x86_64-server-scalefs-5 -c rhel-x86_64-server-sjis-5 -c rhel-x86_64-server-cluster-5 -c rhel-x86_64-server-productivity-5 -c rhel-x86_64-rhev-agent-5-server-beta
Username: qa@redhat.com
Password: 

[root@jsefler-5 ~]# rhn-channel --list
rhel-x86_64-rhev-agent-5-server-beta
rhel-x86_64-server-5
rhel-x86_64-server-cluster-5
rhel-x86_64-server-dts-5
rhel-x86_64-server-eucjp-5
rhel-x86_64-server-productivity-5
rhel-x86_64-server-scalefs-5
rhel-x86_64-server-sjis-5

[root@jsefler-5 ~]# cat /var/lib/rhsm/productid.js 
{
  "69": "anaconda-base-201202021136.x86_64", 
}

[root@jsefler-5 ~]# rhn-migrate-classic-to-rhsm --no-auto
Red Hat account: qa@redhat.com
Password: 
System Engine Username: testuser1
Password: 
Org: admin

Retrieving existing RHN Classic subscription information...

+-----------------------------------------------------+
System is currently subscribed to these RHN Classic Channels:
+-----------------------------------------------------+
rhel-x86_64-server-5
rhel-x86_64-server-dts-5
rhel-x86_64-rhev-agent-5-server-beta
rhel-x86_64-server-sjis-5
rhel-x86_64-server-productivity-5
rhel-x86_64-server-cluster-5
rhel-x86_64-server-eucjp-5
rhel-x86_64-server-scalefs-5

+-----------------------------------------------------+
Installing product certificates for these RHN Classic channels:
+-----------------------------------------------------+
rhel-x86_64-server-5
rhel-x86_64-server-dts-5
rhel-x86_64-rhev-agent-5-server-beta
rhel-x86_64-server-sjis-5
rhel-x86_64-server-productivity-5
rhel-x86_64-server-cluster-5
rhel-x86_64-server-eucjp-5
rhel-x86_64-server-scalefs-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: ef0703a0-3a5a-4ba9-90d0-801d79779a71 
System 'jsefler-5.usersys.redhat.com' successfully registered to Red Hat Subscription Management.

[root@jsefler-5 ~]# cat /var/lib/rhsm/productid.js 
{
  "176": [
    "rhel-x86_64-server-dts-5"
  ], 
  "181": [
    "rhel-x86_64-server-eucjp-5"
  ], 
  "126": [
    "rhel-x86_64-server-sjis-5"
  ], 
  "69": [
    "rhel-x86_64-server-5", 
    "rhel-x86_64-rhev-agent-5-server-beta", 
    "rhel-x86_64-server-productivity-5"
  ], 
  "83": [
    "rhel-x86_64-server-cluster-5"
  ], 
  "92": [
    "rhel-x86_64-server-scalefs-5"
  ]
}[root@jsefler-5 ~]#


VERIFIED: /var/lib/rhsm/productid.js is now populated with productId-to-classicChannel mappings during the migration process.
Comment 9 errata-xmlrpc 2013-11-21 16:26: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-1659.html

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