mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
parent
c1458980f3
commit
1600f3eccd
2 changed files with 14 additions and 6 deletions
|
@ -13,6 +13,7 @@ import copy
|
|||
# Import salt libs
|
||||
import salt.client
|
||||
import salt.output
|
||||
import salt.exceptions
|
||||
from salt.utils import print_cli
|
||||
from salt.ext.six.moves import range
|
||||
|
||||
|
@ -47,11 +48,14 @@ class Batch(object):
|
|||
ping_gen = self.local.cmd_iter(*args, **self.eauth)
|
||||
|
||||
fret = set()
|
||||
for ret in ping_gen:
|
||||
m = next(ret.iterkeys())
|
||||
if m is not None:
|
||||
fret.add(m)
|
||||
return (list(fret), ping_gen)
|
||||
try:
|
||||
for ret in ping_gen:
|
||||
m = next(ret.iterkeys())
|
||||
if m is not None:
|
||||
fret.add(m)
|
||||
return (list(fret), ping_gen)
|
||||
except StopIteration:
|
||||
raise salt.exceptions.SaltClientError('No minions matched the target.')
|
||||
|
||||
def get_bnum(self):
|
||||
'''
|
||||
|
|
|
@ -94,7 +94,11 @@ class SaltCMD(parsers.SaltCMDOptionParser):
|
|||
self._output_ret(ret, '')
|
||||
|
||||
else:
|
||||
batch = salt.cli.batch.Batch(self.config, eauth=eauth)
|
||||
try:
|
||||
batch = salt.cli.batch.Batch(self.config, eauth=eauth)
|
||||
except salt.exceptions.SaltClientError as exc:
|
||||
# We will print errors to the console further down the stack
|
||||
sys.exit(1)
|
||||
# Printing the output is already taken care of in run() itself
|
||||
for res in batch.run():
|
||||
if self.options.failhard:
|
||||
|
|
Loading…
Add table
Reference in a new issue