Bug 1008016 - [RFE] The redhat.repo file should be refreshed after a successful subscription
[RFE] The redhat.repo file should be refreshed after a successful subscription
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: Carter Kozak
John Sefler
: FutureFeature
: 973838 (view as bug list)
Depends On:
Blocks: rhsm-rhel65 1090206
  Show dependency treegraph
 
Reported: 2013-09-13 15:35 EDT by Alex Wood
Modified: 2014-04-22 18:59 EDT (History)
5 users (show)

See Also:
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.
Story Points: ---
Clone Of:
: 1090206 (view as bug list)
Environment:
Last Closed: 2013-11-21 16:29:14 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 Alex Wood 2013-09-13 15:35:55 EDT
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 15:36:52 EDT
Related to bug #973838 but not quite the same.
Comment 3 Carter Kozak 2013-09-24 17:20:16 EDT
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 11:37:09 EDT
*** Bug 973838 has been marked as a duplicate of this bug. ***
Comment 8 Carter Kozak 2013-10-04 12:14:12 EDT
subscription-manager import does not update repos.  A yum transaction will still be required
Comment 9 John Sefler 2013-10-04 16:55:18 EDT
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 16:29:14 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.