Bug 498088 - ipa --help throws traceback
Summary: ipa --help throws traceback
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: freeIPA
Classification: Retired
Component: ipa-admintools
Version: 2.0
Hardware: All
OS: Linux
low
medium
Target Milestone: v2 release
Assignee: Dmitri Pal
QA Contact: Chandrasekar Kannan
URL:
Whiteboard:
: 498545 (view as bug list)
Depends On:
Blocks: 431020
TreeView+ depends on / blocked
 
Reported: 2009-04-28 19:52 UTC by Michael Gregg
Modified: 2015-01-04 23:38 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2012-03-28 09:30:12 UTC
Embargoed:


Attachments (Terms of Use)
One line patch to fix this problem (749 bytes, patch)
2009-04-28 22:09 UTC, Jason Gerard DeRose
no flags Details | Diff

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


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