frontend: do not forward unspecified positional arguments to server

When forwarding a command call to a server, do not use a value of None in
place of unspecified positional arguments.

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

Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
Jan Cholasta 2016-05-19 14:25:47 +02:00
parent 71f960457e
commit 3eaafe42b5

View File

@ -559,8 +559,21 @@ class Command(HasParam):
"""
Split params into (args, options).
"""
args = tuple(params.get(name, None) for name in self.args)
args = tuple()
options = dict(self.__params_2_options(params))
is_arg = True
for name in self.args:
try:
value = params[name]
except KeyError:
is_arg = False
continue
if is_arg:
args += (value,)
else:
options[name] = value
return (args, options)
def __params_2_options(self, params):