Bug 972883

Summary: rhn-migrate-classic-to-rhsm tool neglects to populate /var/lib/rhsm/productid.js
Product: Red Hat Enterprise Linux 6 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED ERRATA QA Contact: IDM QE LIST <seceng-idm-qe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.5CC: alikins, awood, jesusr, lnovich
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
No description necessary.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-21 21:26:23 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: 862910    

Description John Sefler 2013-06-10 18:00:57 UTC
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 19:38:17 UTC
commit cae768ae42963bf0d9c598cf81cefa92360166ff
Author: Alex Wood <awood>
Date:   Thu Jun 13 10:59:55 2013 -0400

    972883: Add entries to productid.js during migration.

Comment 7 Bryan Kearney 2013-06-27 15:39:11 UTC
All modifeid bugs are in a build now. MOving to ON_QA

Comment 8 John Sefler 2013-07-17 15:19:27 UTC
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 --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
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
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 21:26:23 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-1659.html