mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Cleaning up (removing) use of safe_batch token.
This commit is contained in:
parent
02614bdfd1
commit
a4bae3cda9
3 changed files with 10 additions and 12 deletions
|
@ -883,7 +883,7 @@
|
|||
#pillar_cache_ttl: 3600
|
||||
|
||||
# If and only if a master has set `pillar_cache: True`, one of several storage providers
|
||||
# can be utilized.
|
||||
# can be utililzed.
|
||||
#
|
||||
# `disk`: The default storage backend. This caches rendered pillars to the master cache.
|
||||
# Rendered pillars are serialized and deserialized as msgpack structures for speed.
|
||||
|
|
|
@ -103,7 +103,7 @@ class Batch(object):
|
|||
if i:
|
||||
del wait[:i]
|
||||
|
||||
def run(self, safe_batch=False):
|
||||
def run(self):
|
||||
'''
|
||||
Execute the batch run
|
||||
'''
|
||||
|
@ -113,8 +113,6 @@ class Batch(object):
|
|||
self.opts['timeout'],
|
||||
'list',
|
||||
]
|
||||
if safe_batch:
|
||||
self.opts['batch'] = str(safe_batch)
|
||||
bnum = self.get_bnum()
|
||||
# No targets to run
|
||||
if not self.minions:
|
||||
|
|
|
@ -59,7 +59,7 @@ class SaltCMD(parsers.SaltCMDOptionParser):
|
|||
return
|
||||
|
||||
if self.options.preview_target:
|
||||
self._preview_target()
|
||||
minion_list = self._preview_target()
|
||||
self._output_ret(minion_list, self.config.get('output', 'nested'))
|
||||
return
|
||||
|
||||
|
@ -91,8 +91,10 @@ class SaltCMD(parsers.SaltCMDOptionParser):
|
|||
# If batch_safe_limit is set, check minions matching target and
|
||||
# potentially switch to batch execution
|
||||
if self.options.batch_safe_limit > 1:
|
||||
if len(self._preview_target()) >= int(self.options.batch_safe_limit):
|
||||
self._run_batch(self.options.batch_safe_size)
|
||||
if len(self._preview_target()) >= self.options.batch_safe_limit:
|
||||
print_cli('\nNOTICE: Too many minions targeted, switching to batch execution.')
|
||||
self.options.batch = self.options.batch_safe_size
|
||||
self._run_batch()
|
||||
return
|
||||
|
||||
if getattr(self.options, 'return'):
|
||||
|
@ -211,7 +213,7 @@ class SaltCMD(parsers.SaltCMDOptionParser):
|
|||
'''
|
||||
return self.local_client.gather_minions(self.config['tgt'], self.selected_target_option or 'glob')
|
||||
|
||||
def _run_batch(self, safe_batch=False):
|
||||
def _run_batch(self):
|
||||
import salt.cli.batch
|
||||
eauth = {}
|
||||
if 'token' in self.config:
|
||||
|
@ -256,16 +258,14 @@ class SaltCMD(parsers.SaltCMDOptionParser):
|
|||
|
||||
else:
|
||||
try:
|
||||
self.config['batch'] = self.options.batch
|
||||
batch = salt.cli.batch.Batch(self.config, eauth=eauth, parser=self.options)
|
||||
except salt.exceptions.SaltClientError as exc:
|
||||
# We will print errors to the console further down the stack
|
||||
sys.exit(1)
|
||||
if safe_batch:
|
||||
# Batch was triggered by safe limit check, use safe_batch size
|
||||
batch.opts['batch'] = safe_batch
|
||||
# Printing the output is already taken care of in run() itself
|
||||
retcode = 0
|
||||
for res in batch.run(safe_batch):
|
||||
for res in batch.run():
|
||||
for ret in six.itervalues(res):
|
||||
job_retcode = salt.utils.job.get_retcode(ret)
|
||||
if job_retcode > retcode:
|
||||
|
|
Loading…
Add table
Reference in a new issue