fix salt/cli/batch.py TypeError: argument of type int is not iterable

This commit is contained in:
tanlingyun2005 2019-04-20 02:52:50 +08:00
parent 070ae845de
commit 211915ca90
No known key found for this signature in database
GPG key ID: 8A990538320994B2

View file

@ -85,7 +85,8 @@ class Batch(object):
'''
partition = lambda x: float(x) / 100.0 * len(self.minions)
try:
if isinstance(self.opts['batch'], str) and '%' in self.opts['batch']:
if (isinstance(self.opts['batch'], str) or isinstance(self.opts['batch'], unicode)) \
and '%' in self.opts['batch']:
res = partition(float(self.opts['batch'].strip('%')))
if res < 1:
return int(math.ceil(res))