Bug 806457 - If yum runs with no enabled or active repo's, we delete the product cert
If yum runs with no enabled or active repo's, we delete the product cert
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager (Show other bugs)
6.3
Unspecified Unspecified
high Severity urgent
: rc
: ---
Assigned To: Adrian Likins
Entitlement Bugs
: ZStream
: 807433 (view as bug list)
Depends On:
Blocks: 738066 807669 808232 812043 812051 812446
  Show dependency treegraph
 
Reported: 2012-03-23 15:43 EDT by Adrian Likins
Modified: 2012-05-30 09:14 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 807669 812043 812051 (view as bug list)
Environment:
Last Closed: 2012-05-30 09:14:31 EDT
Type: ---
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 Adrian Likins 2012-03-23 15:43:21 EDT
Description of problem:

<install fresh 6.3>
register subscription-manager
sudo yum localinstall <somelocalrpm>

THE INSTALLED PRODUCT CERT GETS DELETED[1]

Why? Because in that scenario, we have no
"active" repos (ie, repo's that are enabled
and have packages installed) or any 
"enabled" repo's (ie, enabled in yum repo config)

In this case, we end up deleting the installed
product cert (we try to delete product certs
that are not active)

Also, we do not log anywhere that a product
cert has been deleted.

[1] </sefler>
Comment 2 Adrian Likins 2012-03-23 16:16:47 EDT
I have a patch that seems to fix this, and it seems fairly straightforward (well, for being productid.py anyway).
Comment 3 wes hayutin 2012-03-27 15:45:23 EDT
*** Bug 807433 has been marked as a duplicate of this bug. ***
Comment 4 Adrian Likins 2012-03-29 16:36:53 EDT
commit 2b349d3120ba24d4021ed7794c28142caf184ecb
Author: Adrian Likins <alikins@redhat.com>
Date:   Fri Mar 23 16:27:19 2012 -0400

    806457: Fix deletion of productids with yum localinstall
    
    If we encounted a scenario where no repo's were considered
    "enabled" and no "active" repos, we would delete the productid.
    A fresh install running a "yum localinstall" would trigger
    it, since no repo's have been enabled.
    
    Check to verify we are not in this scenario before deleting
    productid's.
    
    Also, add some logging describe which productids are being
    deleted. Previously we had no longer for this.
Comment 7 John Sefler 2012-04-09 17:32:28 EDT
Before verifying a fixed subscription-manager, I want to demonstrate a failing subscription-manager....

Installed version of subscription-manager that fails:
[root@jsefler-r63-workstation ~]# rpm -q subscription-manager
subscription-manager-0.99.10-1.el6.x86_64


Steps to reproduce:
[root@jsefler-r63-workstation ~]# subscription-manager register --username qa@redhat.com
Password: 
The system has been registered with id: dbdeaf1e-4389-4ee9-a0e9-499707ea1d53 
[root@jsefler-r63-workstation ~]# yum repolist
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.

repolist: 0
[root@jsefler-r63-workstation ~]# cat /var/lib/rhsm/productid.js 
{
  "71":"anaconda-RedHatEnterpriseLinux.x86_64"
}
[root@jsefler-r63-workstation ~]# ls /etc/pki/product/
71.pem
[root@jsefler-r63-workstation ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:         	Red Hat Enterprise Linux Workstation
Version:              	6.3 Beta                 
Arch:                 	x86_64                   
Status:               	Not Subscribed           
Starts:               	None                     
Expires:              	None                     

[root@jsefler-r63-workstation ~]# 

^^^ WE ARE CLEANLY REGISTERED AND HAVE AN INSTALLED PRODUCT CERT FOR RHEL

[root@jsefler-r63-workstation ~]# wget -q  http://download.devel.redhat.com/brewroot/packages/zsh/4.3.10/5.el6/x86_64/zsh-4.3.10-5.el6.x86_64.rpm
[root@jsefler-r63-workstation ~]# yum -q -y localinstall zsh-4.3.10-5.el6.x86_64.rpm

Warning: RPMDB altered outside of yum.
[root@jsefler-r63-workstation ~]# rpm -q zsh
zsh-4.3.10-5.el6.x86_64
[root@jsefler-r63-workstation ~]# 

^^^ WE HAVE RUN A LOCAL INSTALL OF AN RPM WITHOUT HAVING ANY ACTIVE REPOS

[root@jsefler-r63-workstation ~]# cat /var/lib/rhsm/productid.js 
{}
[root@jsefler-r63-workstation ~]# ls /etc/pki/product/
[root@jsefler-r63-workstation ~]# subscription-manager list --installed
No installed products to list
[root@jsefler-r63-workstation ~]# 

^^^ OUR RHEL PRODUCT CERT (71.pem) IS GONE.  THAT'S THE BUG.
Comment 8 John Sefler 2012-04-09 17:51:07 EDT
Verifying Version....
[root@jsefler-r63-workstation ~]# rpm -q subscription-manager
subscription-manager-0.99.13-1.el6.x86_64


[root@jsefler-r63-workstation ~]# subscription-manager register --username qa@redhat.com
Password: 
The system has been registered with id: 18c1ad10-831a-45bf-bfff-08f361902b39 
[root@jsefler-r63-workstation ~]# yum repolist
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
repolist: 0
[root@jsefler-r63-workstation ~]# cat /var/lib/rhsm/productid.js
{
  "71":"anaconda-RedHatEnterpriseLinux.x86_64"
}
[root@jsefler-r63-workstation ~]# ls /etc/pki/product/
71.pem
[root@jsefler-r63-workstation ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:         	Red Hat Enterprise Linux Workstation
Product ID:           	71                       
Version:              	6.3 Beta                 
Arch:                 	x86_64                   
Status:               	Not Subscribed           
Starts:               	                         
Expires:              	                         

[root@jsefler-r63-workstation ~]# rpm -q zsh
package zsh is not installed
[root@jsefler-r63-workstation ~]# wget -q http://download.devel.redhat.com/brewroot/packages/zsh/4.3.10/5.el6/x86_64/zsh-4.3.10-5.el6.x86_64.rpm
[root@jsefler-r63-workstation ~]# yum -q -y localinstall zsh-4.3.10-5.el6.x86_64.rpm
Warning: RPMDB altered outside of yum.
[root@jsefler-r63-workstation ~]# rpm -q zsh
zsh-4.3.10-5.el6.x86_64

^^^ A YUM LOCAL INSTALL OF ZSH WAS SUCCESSFUL AS EXPECTED

[root@jsefler-r63-workstation ~]# cat /var/lib/rhsm/productid.js 
{
  "71":"anaconda-RedHatEnterpriseLinux.x86_64"
}
[root@jsefler-r63-workstation ~]# ls /etc/pki/product/
71.pem
[root@jsefler-r63-workstation ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:         	Red Hat Enterprise Linux Workstation
Product ID:           	71                       
Version:              	6.3 Beta                 
Arch:                 	x86_64                   
Status:               	Not Subscribed           
Starts:               	                         
Expires:              	                         

^^^ WITHOUT ANY ENABLED REPOS, THE YUM LOCAL INSTALL OF A PACKAGE DID NOT REMOVE OUR INSTALLED PRODUCT CERT (71.pem).  FIX VERIFIED!

[root@jsefler-r63-workstation ~]# yum -q -y remove zsh
[root@jsefler-r63-workstation ~]# rpm -q zsh
package zsh is not installed
[root@jsefler-r63-workstation ~]# cat /var/lib/rhsm/productid.js 
{
  "71":"anaconda-RedHatEnterpriseLinux.x86_64"
}
[root@jsefler-r63-workstation ~]# ls /etc/pki/product/
71.pem
[root@jsefler-r63-workstation ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:         	Red Hat Enterprise Linux Workstation
Product ID:           	71                       
Version:              	6.3 Beta                 
Arch:                 	x86_64                   
Status:               	Not Subscribed           
Starts:               	                         
Expires:              	                         

[root@jsefler-r63-workstation ~]# 

^^^ EVEN AFTER YUM REMOVING THE PACKAGE, THE PRODUCT CERT REMAINS INSTALLED.


Moving to VERIFIED

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