Merge "Make throttle optional"

This commit is contained in:
Zuul 2020-06-08 16:55:55 +00:00 committed by Gerrit Code Review
commit 41f132edb5
1 changed files with 11 additions and 8 deletions

View File

@ -163,8 +163,11 @@ class StrategyModule(BASE.TripleoBase):
task_vars = self._variable_manager.get_vars(**vars_params) task_vars = self._variable_manager.get_vars(**vars_params)
templar = Templar(loader=self._loader, variables=task_vars) templar = Templar(loader=self._loader, variables=task_vars)
# if task has a throttle attribute, check throttle e.g. ansible > 2.9
throttle = getattr(task, 'throttle', None)
if throttle is not None:
try: try:
throttle = int(templar.template(task.throttle)) throttle = int(templar.template(throttle))
except Exception as e: except Exception as e:
raise AnsibleError("Failed to throttle: {}".format(e), raise AnsibleError("Failed to throttle: {}".format(e),
obj=task._df, obj=task._df,