Cast the retrieved `retries` var to an int before incrementing as it may be in string form.

For example, the following method of calculating the value will result in a type error:

    appstatus_waitfor: 4  # Minutes
    appstatus_delay: 5 # seconds
    appstatus_retries: "{{ mins * 60 / delay }}"
pull/5212/head
Steve Smith 11 years ago
parent 36a305ce9d
commit 5b81f88c8f

@ -691,7 +691,7 @@ class Runner(object):
if not utils.check_conditional(cond, self.basedir, inject, fail_on_undefined=self.error_on_undefined_vars):
retries = self.module_vars.get('retries')
delay = self.module_vars.get('delay')
for x in range(1, retries + 1):
for x in range(1, int(retries) + 1):
# template the delay, cast to float and sleep
delay = template.template(self.basedir, delay, inject, expand_lists=False)
delay = float(delay)

Loading…
Cancel
Save