Bug 1251853
| Summary: | When the value of manage_repos is blank, the output of 'repos --list' is not reasonable. | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | qianzhan | |
| Component: | subscription-manager | Assignee: | William Poteat <wpoteat> | |
| Status: | CLOSED ERRATA | QA Contact: | J.C. Molet <jmolet> | |
| Severity: | medium | Docs Contact: | ||
| Priority: | high | |||
| Version: | 7.2 | CC: | alikins, bkearney, crog, jmolet, jsefler, wpoteat | |
| Target Milestone: | rc | |||
| Target Release: | --- | |||
| Hardware: | Unspecified | |||
| OS: | Unspecified | |||
| Whiteboard: | ||||
| Fixed In Version: | Doc Type: | Bug Fix | ||
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 1272203 (view as bug list) | Environment: | ||
| Last Closed: | 2015-11-19 11:50:35 UTC | Type: | Bug | |
| Regression: | --- | Mount Type: | --- | |
| Documentation: | --- | CRM: | ||
| Verified Versions: | Category: | --- | ||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
| Cloudforms Team: | --- | Target Upstream Version: | ||
| Embargoed: | ||||
| Bug Depends On: | ||||
| Bug Blocks: | 1272203 | |||
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
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.
The fix from comment 2 should be tested with subscription-manager-1.15.9-9 or newer. [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. 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: ''
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. 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 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. This bug is VERIFIED for the above reasons ( comment 11 ). Branching issue in comment 12 to new bug. 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 |
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: