Bug 1489917

Summary: disabling yum plugins using "false" (rather than "0") causes traceback: invalid literal for int() with base 10: 'false'
Product: Red Hat Enterprise Linux 7 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Jiri Hnidek <jhnidek>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: medium Docs Contact:
Priority: high    
Version: 7.5CC: awood, jhnidek, khowell, redakkan, skallesh
Target Milestone: rcKeywords: EasyFix, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: subscription-manager-1.20.2-1 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 09:51:13 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:

Description John Sefler 2017-09-08 16:11:14 UTC
Description of problem:
When setting the enabled configuration value in /etc/yum/pluginconf.d/product-id.conf or /etc/yum/pluginconf.d/subscription-manager.conf to "false" or "true" rather than "0" or "1", subscription-manager is blocked by a traceback...
   invalid literal for int() with base 10: 'false'

Note: Yum gracefully accepts both "false"|"0" as booleans values, but subscription-manager does not.

Version-Release number of selected component (if applicable):
[root@jsefler-rhel7 ~]# rpm -q subscription-manager
subscription-manager-1.20.1-1.git.48.bc07705.el7.x86_64


How reproducible:


Steps to Reproduce:
[root@jsefler-rhel7 ~]# subscription-manager unregister 
This system is currently not registered.
[root@jsefler-rhel7 ~]# sed -i 's/^enabled\s*=.*$/enabled=false/g' /etc/yum/pluginconf.d/product-id.conf
[root@jsefler-rhel7 ~]# cat /etc/yum/pluginconf.d/product-id.conf
[main]
enabled=false
[root@jsefler-rhel7 ~]# yum repolist
Loaded plugins: langpacks, search-disabled-repos, subscription-manager    <=== NOTICE product-id WAS NOT LOADED
This system is not registered with an entitlement server. You can use subscription-manager to register.
repolist: 0
[root@jsefler-rhel7 ~]# subscription-manager version
invalid literal for int() with base 10: 'false'
[root@jsefler-rhel7 ~]# 


Actual results:
  invalid literal for int() with base 10: 'false'

Expected results:
  a WARNING message will be displayed when /etc/yum/pluginconf.d/product-id.conf is disabled informing us that it was automatically enabled.


Additional info:

[root@jsefler-rhel7 ~]# tail -f /var/log/rhsm/rhsm.log
2017-09-08 11:42:28,448 [DEBUG] subscription-manager:3072:MainThread @repolib.py:150 - Yum plugin: "/etc/yum/pluginconf.d/subscription-manager.conf" already enabled. Nothing to do.
2017-09-08 11:42:28,449 [ERROR] subscription-manager:3072:MainThread @managercli.py:181 - exception caught in subscription-manager
2017-09-08 11:42:28,449 [ERROR] subscription-manager:3072:MainThread @managercli.py:182 - invalid literal for int() with base 10: 'false'
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 96, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/sbin/subscription-manager", line 87, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib/python2.7/site-packages/subscription_manager/managercli.py", line 2640, in main
    enabled_yum_plugins = YumPluginManager.enable_yum_plugins()
  File "/usr/lib/python2.7/site-packages/subscription_manager/repolib.py", line 148, in enable_yum_plugins
    is_plugin_enabled = yum_plugin_config.getint('main', 'enabled')
  File "/usr/lib/python2.7/site-packages/iniparse/compat.py", line 135, in getint
    return int(self.get(section, option))
ValueError: invalid literal for int() with base 10: 'false'

Comment 2 Shwetha Kallesh 2017-11-10 06:25:54 UTC
[root@dhcp35-121 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: Unknown
subscription management rules: Unknown
subscription-manager: 1.20.5-1.el7

[root@dhcp35-121 ~]#  sed -i 's/^enabled\s*=.*$/enabled=false/g' /etc/yum/pluginconf.d/product-id.conf
[root@dhcp35-121 ~]# cat /etc/yum/pluginconf.d/product-id.conf
[main]
enabled=false

[root@dhcp35-121 ~]#  yum repolist
Loaded plugins: langpacks, search-disabled-repos, subscription-manager
This system is registered with an entitlement server, but is not receiving updates. You can use subscription-manager to assign subscriptions.
repolist: 0

Observe the warning :

[root@dhcp35-121 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: Unknown
subscription management rules: Unknown
subscription-manager: 1.20.5-1.el7


WARNING

The yum plugins: /etc/yum/pluginconf.d/product-id.conf were automatically enabled for the benefit of Red Hat Subscription Management. If not desired, use "subscription-manager config --rhsm.auto_enable_yum_plugins=0" to block this behavior.

Comment 5 errata-xmlrpc 2018-04-10 09:51:13 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://access.redhat.com/errata/RHBA-2018:0681