mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Check for __kwarg__ using get instead of pop and then skip __kwarg__ during the loop.
This commit is contained in:
parent
f2511ff711
commit
88700f894d
1 changed files with 4 additions and 2 deletions
|
@ -327,9 +327,12 @@ def load_args_and_kwargs(func, args, data=None, ignore_invalid=False):
|
|||
invalid_kwargs = []
|
||||
|
||||
for arg in args:
|
||||
if isinstance(arg, dict) and arg.pop("__kwarg__", False) is True:
|
||||
if isinstance(arg, dict) and arg.get("__kwarg__", False) is True:
|
||||
# if the arg is a dict with __kwarg__ == True, then its a kwarg
|
||||
for key, val in arg.items():
|
||||
# Skip __kwarg__ when checking kwargs
|
||||
if key == "__kwarg__":
|
||||
continue
|
||||
if argspec.keywords or key in argspec.args:
|
||||
# Function supports **kwargs or is a positional argument to
|
||||
# the function.
|
||||
|
@ -339,7 +342,6 @@ def load_args_and_kwargs(func, args, data=None, ignore_invalid=False):
|
|||
# list of positional arguments. This keyword argument is
|
||||
# invalid.
|
||||
invalid_kwargs.append("{}={}".format(key, val))
|
||||
arg.update({"__kwarg__": True})
|
||||
continue
|
||||
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue