Red Hat Bugzilla – Bug 614138
yum-rhn-plugin breaks 'yum --help' output
Last modified: 2014-01-21 01:18:27 EST
Description of problem:
With yum-rhn-plugin enabled, running the command 'yum --help' is incomplete in that commands from other plugins are missing (in the output) even though the plugin commands still function.
Version-Release number of selected component (if applicable):
Everytime (run as root) unless --disableplugin=rhnplugin is passed.
Steps to Reproduce:
1. Run yum --help
2. Run yum --help --disableplugin=rhnplugin
3. Verify commands from other plugins (such as list-security from the security plugin).
Commands from other plugins are not listed under 'Commands' in optparse --help output.
All plugin commands should be visible, with or without rhnplugin enabled.
We have in rhnplugin.py following lines in init_hook:
opt_parser = conduit.getOptParser()
(opts, commands) = opt_parser.parse_args()
This will effectively clear self.yum_cli_commands in /usr/share/yum-cli/cli.py (happend in getOptionsConfig when calling self.conf around line 188).
I have no idea how it could break yum or why yum do not like it. James do you have idea?
Seth is the one who had looked at this, IIRC the problem is that when you call opt_parser.parse_args() not all the commands are registered and parse_args() creates and caches the --help text, so when we later re-call parse_args() the new commands (from plugins) don't show up.
I'll add Seth to the CC, but it'll probably be Tue-Wed next week before he can reply.
in the init_hook of the rhnplugin the parse_args() gets called. This notices the --help on the argument and outputs usage() and finishes.
all the rest of the plugins register their arguments in config_hook which has not yet been called at this time so they never get outputted.
if you just run yum and don't add the --help it will output all the command's options properly.
rhn_plugin later in init_hook call up2dateAuth.getLoginInfo which will log in to RHN/Satellite over XMLRPC. We do not want to do this call if:
len(commands) == 0
command is clean
--version has been passed
Is there some way to retrieve commands and options without usage of that parse_args(), which will halt on that --help option?
I did not find any useful method in documentation.
For the two commands you're looking for and HOW you're looking for them you can just look at sys.argv and see if they exist there.
Fixed in upstream.
Backported as rev. 201751.
I also backported https://bugzilla.redhat.com/show_bug.cgi?id=672471#c6 (which is direct cause of bug 627525) as rev. 201753
Verified in yum-rhn-plugin-0.5.4-19.el5
On old (not updated) machine run:
1. yum --help
2. yum --help --disableplugin=rhnplugin
On updated machine run:
3. yum --help
Help pages from 1. and 2. differs. Help page in 3. is same as 2.
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.
When running the "yum --help" command with rhnplugin installed, command line options for other plug-ins were not listed in the output, although the plug-in options were still working. This error has been corrected: plug-in options are now listed.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.
Regression, see bug 729584 .