Bug 498088

Summary: ipa --help throws traceback
Product: [Retired] freeIPA Reporter: Michael Gregg <mgregg>
Component: ipa-admintoolsAssignee: Dmitri Pal <dpal>
Status: CLOSED UPSTREAM QA Contact: Chandrasekar Kannan <ckannan>
Severity: medium Docs Contact:
Priority: low    
Version: 2.0CC: benl, dpal, rcritten
Target Milestone: v2 releaseKeywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-03-28 09:30:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 431020    
Attachments:
Description Flags
One line patch to fix this problem none

Description Michael Gregg 2009-04-28 19:52:34 UTC
Description of problem:
ipa --help throws traceback

Version-Release number of selected component (if applicable):
ipa-server-2.0-2.20090428.el5ipa

Steps to Reproduce:
1. run: ipa --help
2.
3.
  
Actual results:
ipa --help
usage: ipa [options]

options:
  -h, --help        show this help message and exit
  -e KEY=VAL        Set environment variable KEY to VAL
  -c FILE           Load configuration from FILE
  -d, --debug       Produce full debuging output
  -v, --verbose     Produce more verbose output
  -a, --prompt-all  Prompt for ALL values (even if optional)
  -n, --no-prompt   Prompt for NO values (even if required)
Traceback (most recent call last):
  File "/usr/bin/ipa", line 32, in ?
    cli.run(api)
  File "/usr/lib/python2.4/site-packages/ipalib/cli.py", line 679, in run
    api.log.exception('%s: %s', e.__class__.__name__, str(e))
AttributeError: 'API' object has no attribute 'log'

Comment 1 Rob Crittenden 2009-04-28 21:10:56 UTC
Seems to be a python 2.4 issue. I can reproduce this on RHEL 5 but not in Fedora 9.

Comment 2 Jason Gerard DeRose 2009-04-28 22:08:12 UTC
I just emailed the fix to freeipa-devel, along with this email:

Under Python2.4 SystemExit subclasses from Exception (rather than from
BaseException like in Python2.5), so cli.run() was catching a SystemExit
raised by optparse.

This patch changes cli.run() so it catches all StandardError instead of
all Exception.  I've been pretty good about doing this correctly, but I
guess I missed this one.

To reiterate the correct use: all custom exceptions should subclass from
StandardError instead of Exception, and if doing a catch-all try/except,
you should almost always do an `except StandardError` instead of `except
Exception`.

See the exception class hierarchy at the bottom each of these pages:

  http://www.python.org/doc/2.4.4/lib/module-exceptions.html

  http://www.python.org/doc/2.5.4/lib/module-exceptions.html

Comment 3 Jason Gerard DeRose 2009-04-28 22:09:10 UTC
Created attachment 341658 [details]
One line patch to fix this problem

Comment 4 Chandrasekar Kannan 2009-04-28 22:14:07 UTC
why have you closed the bug as "CLOSED/NOTABUG", after having attached a patch ?.
Shouldn't you mark the bug MODIFIED ?

Comment 5 Jason Gerard DeRose 2009-04-28 22:25:43 UTC
Oops, my mistake. I can't seem to select "MODIFIED" now... any advice?

Comment 6 Jason Gerard DeRose 2009-04-28 22:26:47 UTC
Okay, now I can select "MODIFIED".

Comment 7 Rob Crittenden 2009-04-29 02:30:35 UTC
master: 3f4a0a2d7739dc4355313742f4b996face344d7a

Comment 8 Rob Crittenden 2009-05-04 20:35:02 UTC
*** Bug 498545 has been marked as a duplicate of this bug. ***