diff --git a/salt/cloud/__init__.py b/salt/cloud/__init__.py index 436770d96b..4bddbd2cd4 100644 --- a/salt/cloud/__init__.py +++ b/salt/cloud/__init__.py @@ -9,6 +9,7 @@ from __future__ import absolute_import, print_function, generators import os import copy import glob +import inspect import time import signal import logging @@ -1460,8 +1461,14 @@ class Cloud(object): ret[alias][driver] = {} if kwargs: + argnames = inspect.getargspec(self.clouds[fun]).args + [argnames.pop(0) for _ in inspect.getargspec(self.clouds[fun]).defaults] + kws = {} + for kwarg in argnames: + kws[kwarg] = kwargs.get(kwarg, None) + kws['call'] = 'action' ret[alias][driver][vm_name] = self.clouds[fun]( - vm_name, kwargs, call='action' + vm_name, **kws ) else: ret[alias][driver][vm_name] = self.clouds[fun]( diff --git a/salt/runners/cloud.py b/salt/runners/cloud.py index 66795d5a36..9e2952e60b 100644 --- a/salt/runners/cloud.py +++ b/salt/runners/cloud.py @@ -125,18 +125,17 @@ def destroy(instances): return info -def action( - func=None, - cloudmap=None, - instances=None, - provider=None, - instance=None, - **kwargs): +def action(*args, **kwargs): ''' Execute a single action on the given map/provider/instance ''' client = _get_client() - info = client.action(func, cloudmap, instances, provider, instance, kwargs) + info = client.action(args[0], + kwargs.get('cloudmap', None), + args[1:], + kwargs.get('provider', None), + kwargs.get('instance', None), + kwargs) return info