fix TypeError: argument of type int is not iterable

This commit is contained in:
dextertan 2019-04-23 19:07:15 +08:00
parent ed908b3e51
commit d4abddd3ed

View file

@ -8,7 +8,6 @@ from __future__ import absolute_import, print_function, unicode_literals
import math
import time
import copy
import sys
from datetime import datetime, timedelta
# Import salt libs
@ -86,11 +85,7 @@ class Batch(object):
'''
partition = lambda x: float(x) / 100.0 * len(self.minions)
try:
if sys.version_info.major == 3:
batch_is_str = isinstance(self.opts['batch'], str)
else:
batch_is_str = isinstance(self.opts['batch'], str) or isinstance(self.opts['batch'], unicode)
if batch_is_str and '%' in self.opts['batch']:
if isinstance(self.opts['batch'], six.string_types) and '%' in self.opts['batch']:
res = partition(float(self.opts['batch'].strip('%')))
if res < 1:
return int(math.ceil(res))