From 9101c2af984cb5af6550e0f3040b3719069cd8c7 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Fri, 29 Nov 2013 08:47:03 -0600 Subject: [PATCH] Fix traceback in template error detection code Fixes #5081 --- lib/ansible/utils/template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/utils/template.py b/lib/ansible/utils/template.py index d5824e8852f..fd3c48af5cc 100644 --- a/lib/ansible/utils/template.py +++ b/lib/ansible/utils/template.py @@ -102,7 +102,7 @@ def _legacy_varFindLimitSpace(basedir, vars, space, part, lookup_fatal, depth, e if space is None: return space # A part with escaped .s in it is compounded by { and }, remove them - if part[0] == '{' and part[-1] == '}': + if len(part) > 0 and part[0] == '{' and part[-1] == '}': part = part[1:-1] # Template part to resolve variables within (${var$var2}) part = legacy_varReplace(basedir, part, vars, lookup_fatal=lookup_fatal, depth=depth + 1, expand_lists=expand_lists)