RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1170314 - Setting "manage_repos = 0" in /etc/rhsm/rhsm.conf causes subscription-manager to delete redhat.repo
Summary: Setting "manage_repos = 0" in /etc/rhsm/rhsm.conf causes subscription-manager...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager
Version: 6.6
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: rc
: ---
Assignee: Devan Goodwin
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks: rhsm-rhel67
TreeView+ depends on / blocked
 
Reported: 2014-12-03 18:57 UTC by John W. Lamb
Modified: 2015-07-22 06:52 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-07-22 06:52:43 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1345 0 normal SHIPPED_LIVE subscription-manager and python-rhsm bug fix and enhancement update 2015-07-20 17:59:53 UTC

Description John W. Lamb 2014-12-03 18:57:59 UTC
Description of problem:

Setting "manage_repos = 0" in /etc/rhsm/rhsm.conf makes subscription-manager delete /etc/rhsm/rhsm.conf when the plugin is next loaded. This behavior is both surprising and undesirable.

This behavior is not mentioned in the shipped rhsm.conf or in the rhsm.conf man page

subscription-manager will honor customized settings from /etc/yum.repos.d/redhat.repo if they don't have corresponding content overrides set. This implies a contract that is violated when redhat.repo is deleted because "manage_repos" is set to 0. Shouldn't the file be left in place, in order to preserve any custom settings?

This has to be a bug, since deleting the file still counts as "managing"; I think that "manage_repos = 0" should mean that /etc/yum.repos.d/redhat.repo remains untouched.

Version-Release number of selected component (if applicable):

subscription-manager-1.12.14-7.el6.x86_64

How reproducible:

Always

Steps to Reproduce:
1. Set "manage_repos = 0" in /etc/rhsm/rhsm.conf
2. # touch /etc/yum.repos.d/redhat.repo
3. # yum repolist
4. # ls -l /etc/yum.repos.d/

Actual results:

# touch /etc/yum.repos.d/redhat.repo
# ls -l /etc/yum.repos.d/
total 0
-rw-r--r--. 1 root root 0 Dec  3 13:56 redhat.repo
# yum repolist
Loaded plugins: changelog, priorities, product-id, subscription-manager
repolist: 0
# ls -l /etc/yum.repos.d/
total 0
#

Expected results:

The file /etc/yum.repos.d/redhat.repo should still exist.

Additional info:

Comment 2 Devan Goodwin 2015-03-12 12:06:36 UTC
I fear we can't just leave a previously generated redhat.repo laying around as subscription changes can then alter what the system actually has access too, the file is stale, and yum will then stop functioning entirely until someone addresses the discrepancy, which would not be feasible in the case of RH subscriptions.

The manage_repos feature means "do not generate a redhat.repo", and once enabled we make sure to clear the file out so this breakage does not occur.

What is the use case for requiring subscription-manager to generate a redhat.repo, but then stop keeping it updated?

Comment 3 John Sefler 2015-03-12 13:17:45 UTC
The man page for rhsm.conf states...
[root@jsefler-7 ~]# man rhsm.conf | grep manage_repos -A6
       manage_repos
           Set this to 1 if subscription manager should manage a
           yum repos file. If set, it will manage the file
           /etc/yum.repos.d/redhat.repo. If set to 0 then the
           subscription is only used for tracking purposes, not
           content.

The header of the redhat.repo explicitly states...
[root@jsefler-7 ~]# cat /etc/yum.repos.d/redhat.repo 
#
# Certificate-Based Repositories
# Managed by (rhsm) subscription-manager
#
# *** This file is auto-generated.  Changes made here will be over-written. ***
# *** Use "subscription-manager repo-override --help" if you wish to make changes. ***
#
# If this file is empty and this system is subscribed consider 
# a "yum repolist" to refresh available repos
#


Based on these descriptions and my understanding of rhsm, setting manage_repos=0 means that all access to "content" from attached entitlements will cease.  The most effective way to make that cease is for the redhat.repo to go blank or go away.  I believe subscription-manager is doing the right thing when manage_repos is set to 0.

Maybe this bug should be used to explicitly state in the rhsm.conf man page that "If set to 0 then attached subscriptions will only used for system tracking purposes, not system access to content.  The /etc/yum.repos.d/redhat.repo will either be purged or deleted."

Comment 4 Devan Goodwin 2015-03-12 13:32:13 UTC
A man page update sounds fair to me.

Comment 5 John Sefler 2015-03-12 13:37:06 UTC
(In reply to Devan Goodwin from comment #2)
> What is the use case for requiring subscription-manager to generate a
> redhat.repo, but then stop keeping it updated?

I too am curious why you would need to take a perfectly well managed Red Hat yum repository, freeze it in time and allow it to go stale.  Please realize that if you did that, the certificates referenced in the stale redhat.repo could easily be removed by subscription-manager or revoked at the Customer Portal thereby causing yum to choke on the stale redhat.repo file.

Comment 6 John W. Lamb 2015-03-12 15:42:30 UTC
The only use-case I can think of would be to preserve a currently-working repo config against accidental changes from remote overrides. I agree it doesn't make a lot of sense, but in my experience one should anticipate customers will find legitimate reasons to do stuff that doesn't make sense. :)

My main concern was that customers might respond to this behavior by copying out the working `redhat.repo` file to e.g. `our_redhat.repo` and then set `manage_repos` to 0. At the time I filed the bug, this would have broken a tool that I maintain for OpenShift Enterprise - it was using the `repofile` attribute to determine if a `YumRepo` were managed by RHSM, "plain old yum" or RHN.

Since then, I found a different (and more correct) way to do this detection - checking the `RepoActionInvoker` `is_managed` method for systems with newer subscription-manager versions, and falling back to checking the `sslcacert`, `sslclientcert`, etc. and `repofile` on the `YumRepo` for older subscription-manager versions. As far as my needs, this bug is no longer a priority.

That said, I do think this behavior should be documented, so I'm totally on board with the man page update.

Comment 7 Devan Goodwin 2015-04-09 17:33:03 UTC
Manpage updated in subscription-manager.git d197b9c73fb8e4e8861ed0a1cfb60363cfc776a2

Will appear in: subscription-manager-1.14.3-1

Comment 9 Rehana 2015-04-10 11:26:35 UTC
Retested ,

subscription-manager: 1.14.3-1.el6
subscription-manager-gui-1.14.3-1.el6.x86_64
python-rhsm: 1.14.2-1.el6


Man page of rhsm.conf is now updated with,

# man rhsm.conf | grep manage_repos -A6
       manage_repos
           Set this to 1 if subscription manager should manage a yum repos
           file. If set, it will manage the file /etc/yum.repos.d/redhat.repo.
           If set to 0 then the subscription is only used for tracking
           purposes, not content. The /etc/yum.repos.d/redhat.repo file will
           either be purged or deleted.

Moving to Verified.

Comment 10 errata-xmlrpc 2015-07-22 06:52:43 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.

https://rhn.redhat.com/errata/RHBA-2015-1345.html


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