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 1251853 - When the value of manage_repos is blank, the output of 'repos --list' is not reasonable.
Summary: When the value of manage_repos is blank, the output of 'repos --list' is not ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: subscription-manager
Version: 7.2
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: rc
: ---
Assignee: William Poteat
QA Contact: J.C. Molet
URL:
Whiteboard:
Depends On:
Blocks: 1272203
TreeView+ depends on / blocked
 
Reported: 2015-08-10 07:09 UTC by qianzhan
Modified: 2015-11-19 11:50 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1272203 (view as bug list)
Environment:
Last Closed: 2015-11-19 11:50:35 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2122 0 normal SHIPPED_LIVE subscription-manager bug fix and enhancement update 2015-11-19 10:31:14 UTC

Description qianzhan 2015-08-10 07:09:29 UTC
Description of problem:
When the value of manage_repos is blank, the output of 'repos --list' is not reasonable.

Version-Release number of selected component (if applicable):
subscription-manager: 1.15.9-2.el7
python-rhsm: 1.15.4-2.el7


How reproducible:
always.

Steps to Reproduce:
1. Register to satellite and auto-attach.

2. Check the default value of manage_repos:
[root@dhcp-128-89 ~]# subscription-manager config | grep manage_repos   manage_repos = 1

[root@dhcp-128-89 ~]# cat /etc/rhsm/rhsm.conf | grep manage_repos
manage_repos = 1

3. List repos when manage_repos with default value.

[root@dhcp-128-89 ~]# subscription-manager repos --list
+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID:   rhel-7-server-rpms
Repo Name: Red Hat Enterprise Linux 7 Server (RPMs)
Repo URL:  https://hp-magnycours-02.rhts.eng.bos.redhat.com/pulp/repos/Default_O
           rganization/Library/content/dist/rhel/server/7/$releasever/$basearch/
           os
Enabled:   1


4. Set the value as blank in rhsm.conf
[root@dhcp-128-89 ~]# cat /etc/rhsm/rhsm.conf | grep manage_reposmanage_repos = 

[root@dhcp-128-89 ~]# subscription-manager config | grep manage_repos   manage_repos = 

5. List repos when manage_repos with blank value:
[root@dhcp-128-89 ~]# subscription-manager repos --listinvalid literal for int() with base 10: ''


Actual results:
As step 5.

Expected results:
The output of step 5 should be the same with step 3.

Additional info:

Comment 2 Chris "Ceiu" Rog 2015-09-03 18:25:40 UTC
commit de70edb03990242c822b73ada33bdf12f3dc029a
Author: William Poteat <wpoteat>
Date:   Tue Sep 1 10:05:49 2015 -0400

    1251853: Manage repos config entry needs to allow blank value

Comment 4 qianzhan 2015-09-15 10:12:39 UTC
Verifying version:
[root@dhcp-128-145 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 2.2.0.67-Unknown
subscription management rules: 5.16
subscription-manager: 1.15.9-7.el7
python-rhsm: 1.15.4-4.el7

1. Register system to Satellite 6.1.0-20150828.0 and auto-attach.
[root@dhcp-128-145 ~]# subscription-manager register --auto-attach
Registering to: hp-sl2x170zg6-01.rhts.eng.bos.redhat.com:443/rhsm
Username: admin
Password: 
The system has been registered with ID: 8913a151-4497-4af3-956b-9ab908dc22a1 

Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

2. Check the default value of manage_repos:
[root@dhcp-128-145 ~]# subscription-manager config | grep manage_repos
   manage_repos = [1]
[root@dhcp-128-145 ~]# cat /etc/rhsm/rhsm.conf | grep manage_repos
manage_repos = 1

3. List repos when manage_repos with default value.
[root@dhcp-128-145 ~]# subscription-manager repos --list
1 local certificate has been deleted.
+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID:   rhel-7-server-rpms
Repo Name: Red Hat Enterprise Linux 7 Server (RPMs)
Repo URL:  https://hp-sl2x170zg6-01.rhts.eng.bos.redhat.com/pulp/repos/Default_O
           rganization/Library/content/dist/rhel/server/7/$releasever/$basearch/
           os
Enabled:   1

4. Set the value as blank in rhsm.conf
[root@dhcp-128-145 ~]# cat /etc/rhsm/rhsm.conf | grep manage_repos
manage_repos =
[root@dhcp-128-145 ~]# subscription-manager config | grep manage_repos
   manage_repos = 

5. List repos when manage_repos with blank value:
[root@dhcp-128-145 ~]# subscription-manager repos --list
invalid literal for int() with base 10: ''

Moving this bug to ASSIGNED.

Comment 5 John Sefler 2015-09-15 14:01:30 UTC
The fix from comment 2 should be tested with subscription-manager-1.15.9-9 or newer.

Comment 6 J.C. Molet 2015-09-15 15:46:57 UTC
[root@jmolet-vm1 rhsm]# cat /etc/rhsm/rhsm.conf  | grep manage_repos
manage_repos = 1
[root@jmolet-vm1 rhsm]#  subscription-manager config | grep manage_repos
   manage_repos = [1]
[root@jmolet-vm1 rhsm]# subscription-manager repos --list
This system has no repositories available through subscriptions.
[root@jmolet-vm1 rhsm]#  subscription-manager register --serverurl=https://subscription.rhn.stage.redhat.com:443/subscription/ --username=stage_rhsmqe --password=password
Registering to: subscription.rhn.stage.redhat.com:443/subscription/
The system has been registered with ID: 0319e011-2acd-4827-b018-8751dbe782a1 
[root@jmolet-vm1 rhsm]# subscription-manager attach --auto


Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

[root@jmolet-vm1 rhsm]# subscription-manager repos --list
+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID:   rhel-7-server-optional-debug-rpms
Repo Name: Red Hat Enterprise Linux 7 Server - Optional (Debug RPMs)
Repo URL:  https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basearch/optional/debug
Enabled:   0

.... truncated for clarity

[root@jmolet-vm1 rhsm]# vim /etc/rhsm/rhsm.conf 
[root@jmolet-vm1 rhsm]# cat /etc/rhsm/rhsm.conf  | grep manage_repos
manage_repos = 
[root@jmolet-vm1 rhsm]#  subscription-manager config | grep manage_repos
   manage_repos = 
[root@jmolet-vm1 rhsm]# subscription-manager repos --list
Repositories disabled by configuration.

[root@jmolet-vm1 rhsm]# rpm -qa | grep subscription-manager
subscription-manager-gui-1.15.9-10.el7.x86_64
subscription-manager-1.15.9-10.el7.x86_64
subscription-manager-initial-setup-addon-1.15.9-10.el7.x86_64

marking VERIFIED.

Comment 7 John Sefler 2015-10-02 21:26:57 UTC
Re-testing with version...
[root@jsefler-7 ~]# rpm -q subscription-manager
subscription-manager-1.15.9-13.el7.x86_64


[root@jsefler-7 ~]# subscription-manager list --consumed
No consumed subscription pools to list
[root@jsefler-7 ~]# 
[root@jsefler-7 ~]# subscription-manager config --rhsm.manage_repos=""
[root@jsefler-7 ~]# 
[root@jsefler-7 ~]# grep manage_repos /etc/rhsm/rhsm.conf
manage_repos=
[root@jsefler-7 ~]# 
[root@jsefler-7 ~]# subscription-manager repos --list
invalid literal for int() with base 10: ''

BANG! This scenario is failing again.



[root@jsefler-7 ~]# tail -f /var/log/rhsm/rhsm.log
2015-10-02 17:23:19,714 [ERROR] subscription-manager:7541 @managercli.py:160 - exception caught in subscription-manager
2015-10-02 17:23:19,714 [ERROR] subscription-manager:7541 @managercli.py:161 - invalid literal for int() with base 10: ''
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 86, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/sbin/subscription-manager", line 77, in main
    return managercli.ManagerCLI().main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 2633, in main
    return CLI.main(self)
  File "/usr/share/rhsm/subscription_manager/cli.py", line 159, in main
    return cmd.main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 493, in main
    return_code = self._do_command()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 1927, in _do_command
    if managed_repos_disabled():
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 262, in managed_repos_disabled
    return cfg.has_option('rhsm', 'manage_repos') and not int(cfg.get('rhsm', 'manage_repos'))
ValueError: invalid literal for int() with base 10: ''

Comment 8 Adrian Likins 2015-10-05 16:13:06 UTC
pr for this at https://github.com/candlepin/subscription-manager/pull/1319
commit 337994565c2f56fd40c3c87868941ab6d1b31a85
Author: Adrian Likins <alikins>
Date:   Mon Oct 5 12:06:46 2015 -0400

    1251853: Fix errors if "manage_repos = " in cfg
    
    Move managercli.managed_repos_disabled to repolib.manage_repos_enabled()
    
    Make the function handle potential ConfigParser errors, and make
    it return a bool.
    
    Update managercli and repolib to use it.
    
    Add test cases to test_repolib.py




[el-7.1:subscription-manager (alikins/1251853_manage_repos_blank %)]
$ sudo subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name:   Awesome OS Server Basic (multi-entitlement)
Provides:            Awesome OS Server Bits
SKU:                 awesomeos-server-basic-me
Contract:            1
Account:             12331131231
Serial:              1563737719160807702
Pool ID:             8a8d01384e9d0877014e9d08f0200f89
Provides Management: No
Active:              True
Quantity Used:       1
Service Level:       None
Service Type:        Self-Support
Status Details:      Subscription is current
Subscription Type:   Multi-Entitleable
Starts:              07/16/2015
Ends:                07/15/2016
System Type:         Physical

[el-7.1:subscription-manager (alikins/1251853_manage_repos_blank %)]
$ subscription-manager config --rhsm.manage_repos=""
[el-7.1:subscription-manager (alikins/1251853_manage_repos_blank %)]
$ sudo subscription-manager config --rhsm.manage_repos=""
[el-7.1:subscription-manager (alikins/1251853_manage_repos_blank %)]
$ sudo grep manage_repos /etc/rhsm/rhsm.conf
manage_repos=
[el-7.1:subscription-manager (alikins/1251853_manage_repos_blank %)]
$ sudo subscription-manager repos --list
+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID:   content-label-empty-gpg
Repo Name: content-emptygpg
Repo URL:  https://cdn.redhat.com/foo/path
Enabled:   0

Repo ID:   content-label
Repo Name: content
Repo URL:  https://cdn.redhat.com/foo/path
Enabled:   0

Repo ID:   content-label-no-gpg
Repo Name: content-nogpg
Repo URL:  https://cdn.redhat.com/foo/path
Enabled:   0

Repo ID:   never-enabled-content
Repo Name: never-enabled-content
Repo URL:  https://cdn.redhat.com/foo/path/never
Enabled:   0

[el-7.1:subscription-manager (alikins/1251853_manage_repos_blank %)]
$ sudo subscription-manager remove --all
1 subscription removed at the server.
1 local certificate has been deleted.
[el-7.1:subscription-manager (alikins/1251853_manage_repos_blank %)]
$ sudo subscription-manager list --consumed
No consumed subscription pools to list
[el-7.1:subscription-manager (alikins/1251853_manage_repos_blank %)]
$ sudo subscription-manager config --rhsm.manage_repos=""
[el-7.1:subscription-manager (alikins/1251853_manage_repos_blank %)]
$ sudo grep manage_repos /etc/rhsm/rhsm.conf
manage_repos=
[el-7.1:subscription-manager (alikins/1251853_manage_repos_blank %)]
$ sudo subscription-manager repos --list
This system has no repositories available through subscriptions.

Comment 11 J.C. Molet 2015-10-15 14:21:47 UTC
CASE 2:
[root@jmolet-vm2 ~]# subscription-manager list --consumed
No consumed subscription pools to list
[root@jmolet-vm2 ~]# subscription-manager config --rhsm.manage_repos=""
[root@jmolet-vm2 ~]# grep manage_repos /etc/rhsm/rhsm.conf
manage_repos = 
[root@jmolet-vm2 ~]# subscription-manager repos --list
This system has no repositories available through subscriptions.



CASE 1:
[root@jmolet-vm2 ~]# subscription-manager config --rhsm.manage_repos=1
[root@jmolet-vm2 ~]# subscription-manager config | grep manage_repos
   manage_repos = [1]
[root@jmolet-vm2 ~]# subscription-manager repos --list
This system has no repositories available through subscriptions.
[root@jmolet-vm2 ~]# subscription-manager register --serverurl=https://subscription.rhn.stage.redhat.com:443/subscription/ --username=stage_rhsmqe --password=password
Registering to: subscription.rhn.stage.redhat.com:443/subscription/
The system has been registered with ID: dff38b2e-4300-4c91-9d8e-6d93edf6dcc8 
[root@jmolet-vm2 ~]# subscription-manager attach --auto


Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

[root@jmolet-vm2 ~]# subscription-manager config --rhsm.manage_repos=""
[root@jmolet-vm2 ~]# subscription-manager config | grep manage_repos
   manage_repos = 
[root@jmolet-vm2 ~]# subscription-manager repos --list
+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID:   rhel-7-server-optional-debug-rpms
Repo Name: Red Hat Enterprise Linux 7 Server - Optional (Debug RPMs)
Repo URL:  https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basearch/optional/debug
Enabled:   0

--- truncated for clarity ---


[root@jmolet-vm2 ~]#  rpm -qa | grep subscription-manager
subscription-manager-gui-1.15.9-15.el7.x86_64
subscription-manager-1.15.9-15.el7.x86_64
subscription-manager-initial-setup-addon-1.15.9-15.el7.x86_64

Comment 12 J.C. Molet 2015-10-15 18:34:52 UTC
In CASE 1 above, the behavior has changed.  It used to print "Repositories disabled by configuration."  This didn't make sense for an unset field that had a default (the default being 1 in this case) Now it is printing the repos as if it is managed, and the user is left without any clues as to if it is actually managed or not, because config prints out this:

# subscription-manager config | grep manage_repos
   manage_repos = 

When it is unset yum behaves as if it is using managed repositories.  This makes sense because the default is to manage them.  I think when a field is unset that has a default it should print that it is set to a default using square brackets:

# subscription-manager config | grep manage_repos
   manage_repos = [1]

The original bug (the traceback) seems to be fixed but I'm not sure if the above should be addressed here or in a separate issue.

Comment 13 J.C. Molet 2015-10-15 18:36:03 UTC
This bug is VERIFIED for the above reasons ( comment 11 ).  Branching issue in comment 12 to new bug.

Comment 14 errata-xmlrpc 2015-11-19 11:50:35 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-2122.html


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