mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Reduce scope of try except StopIteration wrapping
Aimed to reduce amount of code where in one hand a 3 tuple were returned and in the other hand a 2 tuple value.
This commit is contained in:
parent
5987c4e30e
commit
54cdacb680
1 changed files with 14 additions and 14 deletions
|
@ -58,21 +58,21 @@ class Batch(object):
|
|||
# Broadcast to targets
|
||||
fret = set()
|
||||
nret = set()
|
||||
try:
|
||||
for ret in ping_gen:
|
||||
if ('minions' and 'jid') in ret:
|
||||
for minion in ret['minions']:
|
||||
nret.add(minion)
|
||||
continue
|
||||
else:
|
||||
for ret in ping_gen:
|
||||
if ('minions' and 'jid') in ret:
|
||||
for minion in ret['minions']:
|
||||
nret.add(minion)
|
||||
continue
|
||||
else:
|
||||
try:
|
||||
m = next(six.iterkeys(ret))
|
||||
if m is not None:
|
||||
fret.add(m)
|
||||
return (list(fret), ping_gen, nret.difference(fret))
|
||||
except StopIteration:
|
||||
if not self.quiet:
|
||||
print_cli('No minions matched the target.')
|
||||
return list(fret), ping_gen
|
||||
except StopIteration:
|
||||
if not self.quiet:
|
||||
print_cli('No minions matched the target.')
|
||||
break
|
||||
if m is not None:
|
||||
fret.add(m)
|
||||
return (list(fret), ping_gen, nret.difference(fret))
|
||||
|
||||
def get_bnum(self):
|
||||
'''
|
||||
|
|
Loading…
Add table
Reference in a new issue