Merge pull request #40572 from rallytime/fix-40278

Clean out kwargs dict in cloud.action before calling cloud driver function
This commit is contained in:
Mike Place 2017-04-06 15:53:39 -06:00 committed by GitHub
commit b1698e830e
2 changed files with 6 additions and 1 deletions

View file

@ -1527,6 +1527,11 @@ class Cloud(object):
if driver not in ret[alias]:
ret[alias][driver] = {}
# Clean kwargs of "__pub_*" data before running the cloud action call.
# Prevents calling positional "kwarg" arg before "call" when no kwarg
# argument is present in the cloud driver function's arg spec.
kwargs = salt.utils.clean_kwargs(**kwargs)
if kwargs:
ret[alias][driver][vm_name] = self.clouds[fun](
vm_name, kwargs, call='action'

View file

@ -1628,7 +1628,7 @@ def clean_kwargs(**kwargs):
Return a dict without any of the __pub* keys (or any other keys starting
with a dunder) from the kwargs dict passed into the execution module
functions. These keys are useful for tracking what was used to invoke
the function call, but they may not be desierable to have if passing the
the function call, but they may not be desirable to have if passing the
kwargs forward wholesale.
'''
ret = {}