mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #37611 from jeanpralo/fix-cmd-batch-raw
Fix cmd batch raw
This commit is contained in:
commit
b14faf1c68
2 changed files with 27 additions and 2 deletions
|
@ -194,8 +194,9 @@ class Batch(object):
|
|||
break
|
||||
continue
|
||||
if self.opts.get('raw'):
|
||||
parts.update({part['id']: part})
|
||||
minion_tracker[queue]['minions'].remove(part['id'])
|
||||
parts.update({part['data']['id']: part})
|
||||
if part['data']['id'] in minion_tracker[queue]['minions']:
|
||||
minion_tracker[queue]['minions'].remove(part['data']['id'])
|
||||
else:
|
||||
parts.update(part)
|
||||
for id in part.keys():
|
||||
|
@ -223,6 +224,7 @@ class Batch(object):
|
|||
if bwait:
|
||||
wait.append(datetime.now() + timedelta(seconds=bwait))
|
||||
if self.opts.get('raw'):
|
||||
ret[minion] = data
|
||||
yield data
|
||||
elif self.opts.get('failhard'):
|
||||
# When failhard is passed, we need to return all data to include
|
||||
|
|
|
@ -85,6 +85,29 @@ class StdTest(integration.ModuleCase):
|
|||
continue
|
||||
self.assertTrue(ret['minion'])
|
||||
|
||||
def test_batch(self):
|
||||
'''
|
||||
test cmd_batch
|
||||
'''
|
||||
cmd_batch = self.client.cmd_batch(
|
||||
'minion',
|
||||
'test.ping',
|
||||
)
|
||||
for ret in cmd_batch:
|
||||
self.assertTrue(ret['minion'])
|
||||
|
||||
def test_batch_raw(self):
|
||||
'''
|
||||
test cmd_batch with raw option
|
||||
'''
|
||||
cmd_batch = self.client.cmd_batch(
|
||||
'minion',
|
||||
'test.ping',
|
||||
raw=True,
|
||||
)
|
||||
for ret in cmd_batch:
|
||||
self.assertTrue(ret['data']['success'])
|
||||
|
||||
def test_full_returns(self):
|
||||
'''
|
||||
test cmd_iter
|
||||
|
|
Loading…
Add table
Reference in a new issue