diff options
author | Rob Crittenden <rcritten@redhat.com> | 2008-11-03 17:19:29 -0500 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2008-11-03 17:19:29 -0500 |
commit | d53218a9321eb4def0bfeb484709323de74eef1a (patch) | |
tree | 9d96c8e2cb4f168f21ce57e61b0a864afb9708de /ipalib | |
parent | 5ab203ef48c05d5248222f5462c016a5d610e23e (diff) | |
download | freeipa-d53218a9321eb4def0bfeb484709323de74eef1a.tar.gz freeipa-d53218a9321eb4def0bfeb484709323de74eef1a.tar.xz freeipa-d53218a9321eb4def0bfeb484709323de74eef1a.zip |
Handle exceptions in the command-line instead of in the XMLRPC client plugin
Diffstat (limited to 'ipalib')
-rw-r--r-- | ipalib/cli.py | 10 | ||||
-rw-r--r-- | ipalib/plugins/b_xmlrpc.py | 9 |
2 files changed, 11 insertions, 8 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py index 732e38bbd..8cf8d3043 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -377,6 +377,16 @@ class CLI(object): if callable(cmd.output_for_cli): cmd.output_for_cli(ret) return 0 + except errors.GenericError, err: + code = getattr(err,'faultCode',None) + faultString = getattr(err,'faultString',None) + if not code: + raise err + if code < errors.IPA_ERROR_BASE: + print "%s: %s" % (code, faultString) + else: + print "%s: %s" % (code, getattr(err,'__doc__','')) + return 1 except StandardError, e: print e return 2 diff --git a/ipalib/plugins/b_xmlrpc.py b/ipalib/plugins/b_xmlrpc.py index 2c98fb8a6..9c6af0a03 100644 --- a/ipalib/plugins/b_xmlrpc.py +++ b/ipalib/plugins/b_xmlrpc.py @@ -64,14 +64,7 @@ class xmlrpc(Backend): print e[1] except xmlrpclib.Fault, e: err = errors.convertFault(e) - code = getattr(err,'faultCode',None) - faultString = getattr(err,'faultString',None) - if not code: - raise err - if code < errors.IPA_ERROR_BASE: - print "%s: %s" % (code, faultString) - else: - print "%s: %s" % (code, getattr(err,'__doc__','')) + raise err return api.register(xmlrpc) |