Bug 884343

Summary: --help-commands broken in koji client
Product: [Fedora] Fedora Reporter: T.C. Hollingsworth <tchollingsworth>
Component: kojiAssignee: Dennis Gilmore <dennis>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: dennis, mikem
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-12-10 17:05:43 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:
Attachments:
Description Flags
add some debug statements to koji none

Description T.C. Hollingsworth 2012-12-06 01:20:34 UTC
% rpm -q koji
koji-1.7.0-2.fc17.noarch
% koji --help-commands
Available commands:
Traceback (most recent call last):
  File "/usr/bin/koji", line 5793, in <module>
    options, command, args = get_options()
  File "/usr/bin/koji", line 149, in get_options
    list_commands()
  File "/usr/bin/koji", line 5732, in list_commands
    if desc.startswith('[admin] '):
AttributeError: 'NoneType' object has no attribute 'startswith'

Comment 1 Mike McLean 2012-12-06 19:26:01 UTC
I cannot replicate this. Can you verify your installation? (rpm -V koji)

Comment 2 Michael Schwendt 2012-12-06 19:41:05 UTC
And if that verifies fine, also run "rpm -V python-libs", because of

        desc = handler.__doc__
        if desc.startswith('[admin] '):

and __doc__ may be none if there's a problem with the handler object (logging.StreamHandler).

Comment 3 Michael Schwendt 2012-12-06 19:53:36 UTC
Oops, sorry, ignore previous comment. I've grepped it incorrectly. handler is within koji:

|def list_commands(show_admin=False):
|    handlers = []
|    for name,value in globals().items():
|        if name.startswith('handle_'):
|            alias = name.replace('handle_','')
|            alias = alias.replace('_','-')
|            handlers.append((alias,value))
|        elif name.startswith('anon_handle_'):
|            alias = name.replace('anon_handle_','')
|            alias = alias.replace('_','-')
|            handlers.append((alias,value))
|    handlers.sort()
|    print _("Available commands:")
|    for alias,handler in handlers:
|        desc = handler.__doc__
|        if desc.startswith('[admin] '):
| ...

Comment 4 Mike McLean 2012-12-06 23:53:58 UTC
Created attachment 659106 [details]
add some debug statements to koji

All the handlers in koji have docstrings. I'm lost as to how this can fail on your system but not in my f17 test env.

Can you do the following?
# cp /usr/bin/koji /tmp
# patch /tmp/koji <koji-debug.patch   #attached
# /tmp/koji list-commands

Also, what version of python are you running?

Comment 5 T.C. Hollingsworth 2012-12-08 11:16:38 UTC
Oh, it's because the OLPC folks set $PYTHONOPTIMIZE=2 by default, which strips out docstrings.

This is probably WONTFIX, then. Sorry for the noise.

Comment 6 Mike McLean 2012-12-10 17:05:43 UTC
Ah, ok then.