saltstack/salt — pull request #8290 by terminalmage (2013-11-06 03:39:05+00:00)
Title: Fix argument parsing for invalid kwargs

Salt's argument parser checks the argspec in order to properly allow
positional arguments to be specified in key=value pairs when functions
are run on the command line. However, if a key=value pair is detected,
and the following case happens:

A) **kwargs is not supported by the function
B) The parsed argument name is not in the list of the function's
positional arguments

Then the key=value pair ends up being passed as a positional argument,
leading to unexpected/unintended behavior.

This commit fixes this behavior by accumulating a list of these invalid
keyword arguments, and raising a SaltInvocationError exception if any
are found.