From 5b81f88c8f958db78f64f196f1394156ff1040b7 Mon Sep 17 00:00:00 2001 From: Steve Smith Date: Sat, 7 Dec 2013 10:35:14 +0100 Subject: [PATCH] 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 }}" --- lib/ansible/runner/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index 8fec285b902..df9c3cacf1f 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -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)