Hide Forgot
Description of problem: There is a MalformedURIError which isn't caught explicitly by the yum-cli.py python code, in the function getOptionsConfig(). Instead, it is caught by the yum.errors.ConfigError exception, which fails to print an error message with this input value. Version-Release number of selected component (if applicable): yum-3.4.3-161.el7.noarch How reproducible: Steps to Reproduce: 1. Modify the directive serverURL from /etc/sysconfig/rhn/up2date with a malformed URL. For example, a missing semi-colon (:) or an empty value leads to this error. 2. Execute any yum command. Actual results: # yum update Loaded plugins: enabled_repos_upload, fastestmirror, package_upload, product-id, rhnplugin, search-disabled-repos, subscription-manager Traceback (most recent call last): File "/usr/bin/yum", line 29, in <module> yummain.user_main(sys.argv[1:], exit_code=True) File "/usr/share/yum-cli/yummain.py", line 375, in user_main errcode = main(args) File "/usr/share/yum-cli/yummain.py", line 170, in main base.getOptionsConfig(args) File "/usr/share/yum-cli/cli.py", line 283, in getOptionsConfig e = '%s: %s' % (to_unicode(e.args[1]), repr(e.filename)) IndexError: tuple index out of range Uploading Enabled Repositories Report Loaded plugins: fastestmirror, product-id, rhnplugin, subscription-manager Unable to upload Enabled Repositories Report Expected results: Currently, it is difficult to identify the issue, since printing the error message caught itself an exception. We can expect an output looking like: # yum update Loaded plugins: changelog, fs-snapshot, priorities, refresh-packagekit, rhnplugin, rpm-warm-cache, verify Config error: missing protocol in uri Additional info: The following patch works for me: --- /usr/share/yum-cli/cli.py 2018-08-15 12:10:25.000000000 -0400 +++ /usr/share/yum-cli/cli.py.new 2019-07-16 05:21:57.087669646 -0400 @@ -47,6 +47,7 @@ import yumcommands from yum.i18n import to_unicode, to_utf8, exception2msg +from rhn.rpclib import MalformedURIError # This is for yum-utils/yumdownloader in RHEL-5, where it isn't importing this # directly but did do "from cli import *", and we did have this in 3.2.22. I @@ -279,6 +280,9 @@ except yum.Errors.ConfigError, e: self.logger.critical(_('Config error: %s'), e) sys.exit(1) + except MalformedURIError, e: + self.logger.critical(_('Config error: %s'), e) + sys.exit(1) except IOError, e: e = '%s: %s' % (to_unicode(e.args[1]), repr(e.filename)) self.logger.critical(_('Config error: %s'), e)