Based mainly on Rob's fix proposed in Trac.
---
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.

https://fedorahosted.org/freeipa/ticket/1941

>From 6b4759e252408ed3022673d719cfc16c3a179803 Mon Sep 17 00:00:00 2001
From: Martin Kosek <mko...@redhat.com>
Date: Tue, 11 Oct 2011 10:54:34 +0200
Subject: [PATCH] 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.

https://fedorahosted.org/freeipa/ticket/1941
---
 ipaserver/rpcserver.py |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/ipaserver/rpcserver.py b/ipaserver/rpcserver.py
index 39cdbcc7f353c1d0a01d10ff442a9bf0c66c3df9..35a10926292f01933825772edb852f34ef164619 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:
-- 
1.7.6.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to