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

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

 



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

Thanks.


_______________________________________________
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