Merge pull request #48236 from garethgreenaway/48141_salt_api_local_batch

[2018.3] Fix to cmd_batch
This commit is contained in:
Nicole Thomas 2018-06-25 08:58:48 -04:00 committed by GitHub
commit 6ee856631b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View file

@ -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\' '

View file

@ -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)