Bug 614138 - yum-rhn-plugin breaks 'yum --help' output
Summary: yum-rhn-plugin breaks 'yum --help' output
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: yum-rhn-plugin
Version: 5.5
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Miroslav Suchý
QA Contact: Martin Minar
Depends On:
Blocks: 729584
TreeView+ depends on / blocked
Reported: 2010-07-13 18:15 UTC by BJ Dierkes
Modified: 2016-07-04 00:55 UTC (History)
8 users (show)

Fixed In Version: yum-rhn-plugin-0.5.4-19.el5
Doc Type: Bug Fix
Doc Text:
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.
Clone Of:
Last Closed: 2011-07-21 07:10:48 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:0998 normal SHIPPED_LIVE yum-rhn-plugin bug fix update 2011-07-20 15:44:51 UTC

Description BJ Dierkes 2010-07-13 18:15:30 UTC
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):


How reproducible:

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).

Actual results:

Commands from other plugins are not listed under 'Commands' in optparse --help output.

Expected results:

All plugin commands should be visible, with or without rhnplugin enabled.

Comment 1 Miroslav Suchý 2010-07-15 08:17:05 UTC
We have in rhnplugin.py following lines in init_hook:
    opt_parser = conduit.getOptParser()
    if opt_parser:
        (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?

Comment 2 James Antill 2010-07-15 13:28:40 UTC
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.

Comment 3 seth vidal 2010-07-20 12:28:16 UTC
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.

Comment 4 Miroslav Suchý 2010-07-20 14:05:13 UTC
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.

Comment 5 seth vidal 2010-07-20 14:12:45 UTC
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.

Comment 8 Miroslav Suchý 2011-01-12 12:37:52 UTC
Fixed in upstream.
See https://bugzilla.redhat.com/show_bug.cgi?id=627525#c3

Comment 9 Miroslav Suchý 2011-03-15 13:50:01 UTC
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

Comment 11 Martin Minar 2011-04-04 14:28:23 UTC
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.

Comment 12 Eliska Slobodova 2011-06-15 12:33:20 UTC
    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.
    New Contents:
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.

Comment 13 errata-xmlrpc 2011-07-21 07:10:48 UTC
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.


Comment 14 unixadmin 2011-08-17 08:44:39 UTC
Regression, see bug 729584 .

Reopen please.

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