Bug 614138 - yum-rhn-plugin breaks 'yum --help' output
yum-rhn-plugin breaks 'yum --help' output
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: yum-rhn-plugin (Show other bugs)
5.5
All Linux
low Severity medium
: rc
: ---
Assigned To: Miroslav Suchý
Martin Minar
:
Depends On:
Blocks: 729584
  Show dependency treegraph
 
Reported: 2010-07-13 14:15 EDT by BJ Dierkes
Modified: 2014-01-21 01:18 EST (History)
7 users (show)

See Also:
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.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-07-21 03:10:48 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description BJ Dierkes 2010-07-13 14:15:30 EDT
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):

yum-3.2.22-26.el5
yum-rhn-plugin-0.5.4-15.el5


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 04:17:05 EDT
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 09:28:40 EDT
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 08:28:16 EDT
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 10:05:13 EDT
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 10:12:45 EDT
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 07:37:52 EST
Fixed in upstream.
See https://bugzilla.redhat.com/show_bug.cgi?id=627525#c3
Comment 9 Miroslav Suchý 2011-03-15 09:50:01 EDT
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 10:28:23 EDT
Verified in yum-rhn-plugin-0.5.4-19.el5

Reproducer:

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 08:33:20 EDT
    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 03:10:48 EDT
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.

http://rhn.redhat.com/errata/RHBA-2011-0998.html
Comment 14 unixadmin 2011-08-17 04:44:39 EDT
Regression, see bug 729584 .

Reopen please.

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