From 070bc7f725dc33e61bf421b9973292721ae6fbfa Mon Sep 17 00:00:00 2001 From: Martin Kosek Date: Tue, 11 Oct 2011 10:54:34 +0200 Subject: Fix dnszone-add name_from_ip server validation Ticket 1627 contained a (temporary hack-ish) fix for dnszone-add name_from_ip validation which works fine for CLI. However, when the command is not proceeded via CLI and sent directly to the RPC server, the server throws Internal Server Error. Make sure that the server returns a reasonable error. Also implement 2 unit cases testing this option https://fedorahosted.org/freeipa/ticket/1941 --- ipaserver/rpcserver.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'ipaserver/rpcserver.py') diff --git a/ipaserver/rpcserver.py b/ipaserver/rpcserver.py index 39cdbcc7..35a10926 100644 --- a/ipaserver/rpcserver.py +++ b/ipaserver/rpcserver.py @@ -231,7 +231,14 @@ class WSGIExecutioner(Executioner): finally: os.environ['LANG'] = lang if name: - params = self.Command[name].args_options_2_params(*args, **options) + try: + params = self.Command[name].args_options_2_params(*args, **options) + except Exception, e: + self.info( + 'exception %s caught when converting options: %s', e.__class__.__name__, str(e) + ) + # get at least some context of what is going on + params = options if error: self.info('%s: %s(%s): %s', context.principal, name, ', '.join(self.Command[name]._repr_iter(**params)), e.__class__.__name__) else: -- cgit