mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-10-13 17:02:02 -05:00
Handle exceptions in the command-line instead of in the XMLRPC client plugin
This commit is contained in:
1 parent
5ab203ef48
commit
d53218a932
2 files changed
+11
-8
No files matched your search
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user