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/cli.py | |
parent | 5ab203ef48c05d5248222f5462c016a5d610e23e (diff) | |
download | freeipa.git-d53218a9321eb4def0bfeb484709323de74eef1a.tar.gz freeipa.git-d53218a9321eb4def0bfeb484709323de74eef1a.tar.xz freeipa.git-d53218a9321eb4def0bfeb484709323de74eef1a.zip |
Handle exceptions in the command-line instead of in the XMLRPC client plugin
Diffstat (limited to 'ipalib/cli.py')
-rw-r--r-- | ipalib/cli.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py index 732e38bb..8cf8d304 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 |