Merge pull request #31061 from rallytime/revert-breakage

Revert #30217 - was causing salt-cloud -a breakage
This commit is contained in:
Mike Place 2016-02-10 11:13:59 -07:00
commit 4d6706b3e7
2 changed files with 10 additions and 27 deletions

View file

@ -9,7 +9,6 @@ from __future__ import absolute_import, print_function, generators
import os
import copy
import glob
import inspect
import time
import signal
import logging
@ -1494,15 +1493,8 @@ class Cloud(object):
ret[alias][driver] = {}
if kwargs:
argnames = inspect.getargspec(self.clouds[fun]).args
for _ in inspect.getargspec(self.clouds[fun]).defaults:
argnames.pop(0)
kws = {}
for kwarg in argnames:
kws[kwarg] = kwargs.get(kwarg, None)
kws['call'] = 'action'
ret[alias][driver][vm_name] = self.clouds[fun](
vm_name, **kws
vm_name, kwargs, call='action'
)
else:
ret[alias][driver][vm_name] = self.clouds[fun](

View file

@ -6,15 +6,14 @@ The Salt Cloud Runner
This runner wraps the functionality of salt cloud making salt cloud routines
available to all internal apis via the runner system
'''
from __future__ import absolute_import
# Import python libs
from __future__ import absolute_import
import logging
import os
# Import Salt libs
import salt.cloud
from salt.exceptions import SaltCloudConfigError
# Get logging started
log = logging.getLogger(__name__)
@ -130,12 +129,14 @@ def destroy(instances):
return info
def action(*args, **kwargs):
def action(func=None,
cloudmap=None,
instances=None,
provider=None,
instance=None,
**kwargs):
'''
Execute a single action on the given map/provider/instance.
Returns a dictionary of action info. If something goes wrong,
an empty dictionary will be returned.
Execute a single action on the given map/provider/instance
CLI Example:
@ -144,17 +145,7 @@ def action(*args, **kwargs):
salt-run cloud.actions start my-salt-vm
'''
client = _get_client()
try:
info = client.action(args[0],
kwargs.get('cloudmap', None),
args[1:],
kwargs.get('provider', None),
kwargs.get('instance', None),
kwargs)
except SaltCloudConfigError as err:
log.error(err)
return {}
info = client.action(func, cloudmap, instances, provider, instance, kwargs)
return info