Re: [PATCH] Fix traceback on commands run with -h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 19, 2008 at 01:47:45PM -0500, Michael DeHaan wrote:
> Jeremy Rosengren wrote:
> >Jeremy Rosengren wrote:
> >>Michael DeHaan wrote:
> >>>I don't agree with the patch, but it looks like your particular 
> >>>version of optparse is throwing system.exit in a way that cobbler 
> >>>doesn't like and we need to catch that /also/.
> >>>
> >>>I'll look into it.   Thanks.
> >>>
> >I looked through the Python documentation and it looks like the 
> >SystemExit exception needs to be caught, so I added that to the other 
> >exception handling in cobbler.py
> >
> >I don't claim to know for sure that this is the best way to do it, 
> >just that it solves the problem better than my last attempt.
> >
> >Thanks,
> >
> >-- j
> >
> >---
> >cobbler/cobbler.py |    2 +-
> >1 files changed, 1 insertions(+), 1 deletions(-)
> >
> >diff --git a/cobbler/cobbler.py b/cobbler/cobbler.py
> >index fb9b273..9f95f1e 100755
> >--- a/cobbler/cobbler.py
> >+++ b/cobbler/cobbler.py
> >@@ -52,7 +52,7 @@ def main():
> >    try:
> >        # FIXME: redo locking code?
> >        return BootCLI().run(sys.argv)
> >-    except CX, exc:
> >+    except (CX, SystemExit), exc:
> >        print str(exc)[1:-1]  # remove framing air quotes
> >    except Exception, exc2:
> >        if str(type(exc2)).find("CX") == -1:
> 
> Will apply -- (not sure if the double exception catching on one line is 
> legal syntax -- but something like it anyway).

It is only legal in python >= 2.5, so you'll need to fix that if you
support 2.4 or earlier for cobbler

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux