mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #48236 from garethgreenaway/48141_salt_api_local_batch
[2018.3] Fix to cmd_batch
This commit is contained in:
commit
6ee856631b
2 changed files with 17 additions and 0 deletions
|
@ -559,6 +559,11 @@ class LocalClient(object):
|
|||
{'stewart': {...}}
|
||||
'''
|
||||
if 'expr_form' in kwargs:
|
||||
# We need to re-import salt.utils.versions here
|
||||
# even though it has already been imported.
|
||||
# when cmd_batch is called via the NetAPI
|
||||
# the module is unavailable.
|
||||
import salt.utils.versions
|
||||
salt.utils.versions.warn_until(
|
||||
'Fluorine',
|
||||
'The target type should be passed using the \'tgt_type\' '
|
||||
|
|
|
@ -37,6 +37,18 @@ class NetapiClientTest(TestCase):
|
|||
ret = self.netapi.run(low)
|
||||
self.assertEqual(ret, {'minion': True, 'sub_minion': True, 'localhost': True})
|
||||
|
||||
def test_local_batch(self):
|
||||
low = {'client': 'local_batch', 'tgt': '*', 'fun': 'test.ping'}
|
||||
low.update(self.eauth_creds)
|
||||
|
||||
ret = self.netapi.run(low)
|
||||
rets = []
|
||||
for _ret in ret:
|
||||
rets.append(_ret)
|
||||
self.assertIn({'localhost': True}, rets)
|
||||
self.assertIn({'sub_minion': True}, rets)
|
||||
self.assertIn({'minion': True}, rets)
|
||||
|
||||
def test_local_async(self):
|
||||
low = {'client': 'local_async', 'tgt': '*', 'fun': 'test.ping'}
|
||||
low.update(self.eauth_creds)
|
||||
|
|
Loading…
Add table
Reference in a new issue