Adding note about why salt.utils.versions is being re-imported. Adding a test for local_batch.

This commit is contained in:
Gareth J. Greenaway 2018-06-21 16:10:29 -07:00
parent 808805fd3d
commit 85cef126e0
No known key found for this signature in database
GPG key ID: 10B62F8A7CAD7A41
2 changed files with 14 additions and 0 deletions

View file

@ -559,6 +559,10 @@ class LocalClient(object):
{'stewart': {...}}
'''
if 'expr_form' in kwargs:
# We need to report 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',

View file

@ -37,6 +37,16 @@ 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.assertEqual(rets, [{u'sub_minion': True}, {u'minion': True}, {'localhost': True}])
def test_local_async(self):
low = {'client': 'local_async', 'tgt': '*', 'fun': 'test.ping'}
low.update(self.eauth_creds)