From 3eaafe42b52d3c76517946fa4c2c1c120065b9fa Mon Sep 17 00:00:00 2001 From: Jan Cholasta Date: Thu, 19 May 2016 14:25:47 +0200 Subject: [PATCH] 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 --- ipalib/frontend.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ipalib/frontend.py b/ipalib/frontend.py index 119987b8e..c7bbead32 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -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):