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
This commit is contained in:
Martin Kosek
2011-10-11 10:54:34 +02:00
parent 2916ad4ac2
commit 070bc7f725
2 changed files with 56 additions and 1 deletions

View File

@@ -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: