Merge pull request #35634 from hu-dabao/fix-34922

fix 34922, StopIteration should not throw exception out
This commit is contained in:
Mike Place 2016-08-23 17:13:08 +09:00 committed by GitHub
commit f305389172

View file

@ -53,15 +53,17 @@ class Batch(object):
ping_gen = self.local.cmd_iter(*args, **self.eauth)
# Broadcast to targets
fret = set()
try:
for ret in ping_gen:
m = next(six.iterkeys(ret))
if m is not None:
fret.add(m)
return (list(fret), ping_gen)
except StopIteration:
raise salt.exceptions.SaltClientError('No minions matched the target.')
if not self.quiet:
print_cli('No minions matched the target.')
return list(fret), ping_gen
def get_bnum(self):
'''
@ -101,6 +103,9 @@ class Batch(object):
'list',
]
bnum = self.get_bnum()
# No targets to run
if not self.minions:
return
to_run = copy.deepcopy(self.minions)
active = []
ret = {}