Bug 1008016 - [RFE] The redhat.repo file should be refreshed after a successful subscription
Summary: [RFE] The redhat.repo file should be refreshed after a successful subscription
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager
Version: 6.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Carter Kozak
QA Contact: John Sefler
URL:
Whiteboard:
: 973838 (view as bug list)
Depends On:
Blocks: rhsm-rhel65 1090206
TreeView+ depends on / blocked
 
Reported: 2013-09-13 19:35 UTC by Alex Wood
Modified: 2014-04-22 22:59 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Feature: subscription-manager should lay down the redhat.repo file as soon as is possible. Reason: a user attaches to a subscription using subscription-manager, the /etc/yum.repos.d/redhat.repo file is left empty. Result (if any): The redhat.repo file is generated after attachment instead of waiting for yum.
Clone Of:
: 1090206 (view as bug list)
Environment:
Last Closed: 2013-11-21 21:29:14 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:1659 normal SHIPPED_LIVE subscription-manager and python-rhsm bug fix and enhancement update 2013-11-20 21:53:10 UTC

Description Alex Wood 2013-09-13 19:35:55 UTC
Description of problem:
Currently, after a user attaches to a subscription using subscription-manager, the /etc/yum.repos.d/redhat.repo file is left empty.  In order to reflect the available repos, the customer must trigger the subscription-manager yum plugin by running a yum command such as "yum repolist".  Alternatively, the customer can wait until rhsmcertd runs (so long as the daemon is run without the --autoheal argument).

Instead, subscription-manager should lay down the redhat.repo file as soon as is possible.  Waiting to write to the file only serves to confuse people who are expecting their repos to show up immediately.

This should be simple to do by adding a 

    rl = RepoLib(uep=uep)
    rl.update()

bit to the places where attaching occurs.

This issue is also an excellent candidate for a plugin.  Simply listen to the post_auto_attach and post_subscribe events and run a simple repolib update afterwards.

How reproducible: Always

Steps to Reproduce:
1. On a standard RHEL 6 box pointed to stage: subscription-manager register --autosubscribe --username=qa@redhat.com

OR

Register to subscription manager without --auto and then run a subscription-manager attach --auto

OR

Use subscription-manager-gui to register and attach

2. After a successful subscription, cat /etc/yum.repos.d/redhat.repo


Actual results:
The repo file is empty except for an informational header.

Expected results:
The repo file is populated with the appropriate repos from the entitlement cert.

Comment 1 Alex Wood 2013-09-13 19:36:52 UTC
Related to bug #973838 but not quite the same.

Comment 3 Carter Kozak 2013-09-24 21:20:16 UTC
commit dafb01df502e8b1cd197a325815b9930f97aa5d9
Author: ckozak <ckozak@redhat.com>
Date:   Tue Sep 24 09:08:59 2013 -0400

    keep repolib in certmgr

commit cebde288bbe4005a82345882fcfcce742b49b039
Author: ckozak <ckozak@redhat.com>
Date:   Mon Sep 23 11:13:51 2013 -0400

    1008016: update repos on certlib change

Comment 7 Carter Kozak 2013-10-03 15:37:09 UTC
*** Bug 973838 has been marked as a duplicate of this bug. ***

Comment 8 Carter Kozak 2013-10-04 16:14:12 UTC
subscription-manager import does not update repos.  A yum transaction will still be required

Comment 9 John Sefler 2013-10-04 20:55:18 UTC
Verifying Version...
[root@jsefler-6 ~]# rpm -q subscription-manager
subscription-manager-1.9.8-1.el6.x86_64


[root@jsefler-6 ~]# cat /etc/yum.repos.d/redhat.repo 
#
# Certificate-Based Repositories
# Managed by (rhsm) subscription-manager
#
# If this file is empty and this system is subscribed consider 
# a "yum repolist" to refresh available repos
#

[root@jsefler-6 ~]# subscription-manager register --serverurl=jsefler-f14-candlepin.usersys.redhat.com:8443/candlepin --autosubscribe
Username: testuser1
Password: 
Organization: admin
The system has been registered with ID: cf705ef9-a16f-41a9-ae77-11960f6874c1 
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Not Subscribed

Product Name: Stackable with Awesome OS for x86_64 Bits
Status:       Subscribed

Product Name: Awesome OS for x86_64 Bits
Status:       Subscribed

[root@jsefler-6 ~]# cat /etc/yum.repos.d/redhat.repo 
#
# Certificate-Based Repositories
# Managed by (rhsm) subscription-manager
#
# If this file is empty and this system is subscribed consider 
# a "yum repolist" to refresh available repos
#

[awesomeos]
name = awesomeos
baseurl = https://cdn.redhat.com/path/to/$basearch/$releasever/awesomeos
enabled = 0
gpgcheck = 1
gpgkey = https://cdn.redhat.com/path/to/awesomeos/gpg/
sslverify = 1
sslcacert = /etc/rhsm/ca/redhat-uep.pem
sslclientkey = /etc/pki/entitlement/4624892904996646718-key.pem
sslclientcert = /etc/pki/entitlement/4624892904996646718.pem
metadata_expire = 3600
ui_repoid_vars = basearch releasever

[awesomeos-x86_64]
name = awesomeos-x86_64
baseurl = https://cdn.redhat.com/path/to/awesomeos/x86_64
enabled = 0
gpgcheck = 1
gpgkey = https://cdn.redhat.com/path/to/awesomeos/gpg/
sslverify = 1
sslcacert = /etc/rhsm/ca/redhat-uep.pem
sslclientkey = /etc/pki/entitlement/4624892904996646718-key.pem
sslclientcert = /etc/pki/entitlement/4624892904996646718.pem
metadata_expire = 3600

[never-enabled-content]
name = never-enabled-content
baseurl = https://cdn.redhat.com/foo/path/never
enabled = 0
gpgcheck = 1
gpgkey = https://cdn.redhat.com/foo/path/never/gpg
sslverify = 1
sslcacert = /etc/rhsm/ca/redhat-uep.pem
sslclientkey = /etc/pki/entitlement/4624892904996646718-key.pem
sslclientcert = /etc/pki/entitlement/4624892904996646718.pem
metadata_expire = 600
[root@jsefler-6 ~]# subscription-manager unsubscribe --all
2 subscriptions removed at the server.
2 local certificates have been deleted.
[root@jsefler-6 ~]# cat /etc/yum.repos.d/redhat.repo 
#
# Certificate-Based Repositories
# Managed by (rhsm) subscription-manager
#
# If this file is empty and this system is subscribed consider 
# a "yum repolist" to refresh available repos
#

[root@jsefler-6 ~]# subscription-manager list --available | grep Pool | tail -1
Pool ID:           8a9087404175311a01417531e32e0bd4
[root@jsefler-6 ~]# subscription-manager subscribe --pool=8a9087404175311a01417531e32e0bd4
Successfully attached a subscription for: Awesome OS with up to 4 virtual guests
[root@jsefler-6 ~]# cat /etc/yum.repos.d/redhat.repo 
#
# Certificate-Based Repositories
# Managed by (rhsm) subscription-manager
#
# If this file is empty and this system is subscribed consider 
# a "yum repolist" to refresh available repos
#

[content-label-empty-gpg]
name = content-emptygpg
baseurl = https://cdn.redhat.com/foo/path
enabled = 0
gpgcheck = 0
sslverify = 1
sslcacert = /etc/rhsm/ca/redhat-uep.pem
sslclientkey = /etc/pki/entitlement/198645070745688795-key.pem
sslclientcert = /etc/pki/entitlement/198645070745688795.pem

[content-label]
name = content
baseurl = https://cdn.redhat.com/foo/path
enabled = 0
gpgcheck = 1
gpgkey = https://cdn.redhat.com/foo/path/gpg/
sslverify = 1
sslcacert = /etc/rhsm/ca/redhat-uep.pem
sslclientkey = /etc/pki/entitlement/198645070745688795-key.pem
sslclientcert = /etc/pki/entitlement/198645070745688795.pem

[content-label-no-gpg]
name = content-nogpg
baseurl = https://cdn.redhat.com/foo/path
enabled = 0
gpgcheck = 0
sslverify = 1
sslcacert = /etc/rhsm/ca/redhat-uep.pem
sslclientkey = /etc/pki/entitlement/198645070745688795-key.pem
sslclientcert = /etc/pki/entitlement/198645070745688795.pem

[never-enabled-content]
name = never-enabled-content
baseurl = https://cdn.redhat.com/foo/path/never
enabled = 0
gpgcheck = 1
gpgkey = https://cdn.redhat.com/foo/path/never/gpg
sslverify = 1
sslcacert = /etc/rhsm/ca/redhat-uep.pem
sslclientkey = /etc/pki/entitlement/198645070745688795-key.pem
sslclientcert = /etc/pki/entitlement/198645070745688795.pem
metadata_expire = 600
[root@jsefler-6 ~]# subscription-manager unregister
System has been unregistered.
[root@jsefler-6 ~]# cat /etc/yum.repos.d/redhat.repo 
#
# Certificate-Based Repositories
# Managed by (rhsm) subscription-manager
#
# If this file is empty and this system is subscribed consider 
# a "yum repolist" to refresh available repos
#

[root@jsefler-6 ~]# 


VERIFIED: As demonstrated above, the redhat.repo file is updated automatically without any explicit yum transaction calls upon registration with --autosubscribe, after unsubscribing, after individually subscribing, and after unregistering.

Comment 10 errata-xmlrpc 2013-11-21 21:29:14 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


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