mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #31061 from rallytime/revert-breakage
Revert #30217 - was causing salt-cloud -a breakage
This commit is contained in:
commit
4d6706b3e7
2 changed files with 10 additions and 27 deletions
|
@ -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](
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue