mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #40680 from rallytime/bp-40598
Back-port #40598 to 2016.11
This commit is contained in:
commit
7ea526f59e
2 changed files with 25 additions and 1 deletions
|
@ -516,10 +516,20 @@ class LocalClient(object):
|
|||
if 'gather_job_timeout' in kwargs:
|
||||
opts['gather_job_timeout'] = kwargs['gather_job_timeout']
|
||||
|
||||
eauth = {}
|
||||
if 'eauth' in kwargs:
|
||||
eauth['eauth'] = kwargs.pop('eauth')
|
||||
if 'username' in kwargs:
|
||||
eauth['username'] = kwargs.pop('username')
|
||||
if 'password' in kwargs:
|
||||
eauth['password'] = kwargs.pop('password')
|
||||
if 'token' in kwargs:
|
||||
eauth['token'] = kwargs.pop('token')
|
||||
|
||||
for key, val in six.iteritems(self.opts):
|
||||
if key not in opts:
|
||||
opts[key] = val
|
||||
batch = salt.cli.batch.Batch(opts, quiet=True)
|
||||
batch = salt.cli.batch.Batch(opts, eauth=eauth, quiet=True)
|
||||
for ret in batch.run():
|
||||
yield ret
|
||||
|
||||
|
|
|
@ -109,6 +109,20 @@ class NetapiClient(object):
|
|||
local = salt.client.get_local_client(mopts=self.opts)
|
||||
return local.cmd_subset(*args, **kwargs)
|
||||
|
||||
def local_batch(self, *args, **kwargs):
|
||||
'''
|
||||
Run :ref:`execution modules <all-salt.modules>` against batches of minions
|
||||
|
||||
.. versionadded:: 0.8.4
|
||||
|
||||
Wraps :py:meth:`salt.client.LocalClient.cmd_batch`
|
||||
|
||||
:return: Returns the result from the exeuction module for each batch of
|
||||
returns
|
||||
'''
|
||||
local = salt.client.get_local_client(mopts=self.opts)
|
||||
return local.cmd_batch(*args, **kwargs)
|
||||
|
||||
def ssh(self, *args, **kwargs):
|
||||
'''
|
||||
Run salt-ssh commands synchronously
|
||||
|
|
Loading…
Add table
Reference in a new issue