Browse code

Avoid templating raw lookup strings

James Cammarata authored on 2014/07/29 06:21:37
Showing 2 changed files
... ...
@@ -50,7 +50,7 @@ class ActionModule(object):
50 50
                 result = dict(failed=True, msg=args['msg'])
51 51
             else:
52 52
                 result = dict(msg=args['msg'])
53
-        elif 'var' in args:
53
+        elif 'var' in args and not utils.LOOKUP_REGEX.search(args['var']):
54 54
             results = template.template(self.basedir, "{{ %s }}" % args['var'], inject)
55 55
             result[args['var']] = results
56 56
 
... ...
@@ -1257,7 +1257,10 @@ def listify_lookup_plugin_terms(terms, basedir, inject):
1257 1257
         #    with_items: {{ alist }}
1258 1258
 
1259 1259
         stripped = terms.strip()
1260
-        if not (stripped.startswith('{') or stripped.startswith('[')) and not stripped.startswith("/") and not stripped.startswith('set(['):
1260
+        if not (stripped.startswith('{') or stripped.startswith('[')) and \
1261
+           not stripped.startswith("/") and \
1262
+           not stripped.startswith('set([') and \
1263
+           not LOOKUP_REGEX.search(terms):
1261 1264
             # if not already a list, get ready to evaluate with Jinja2
1262 1265
             # not sure why the "/" is in above code :)
1263 1266
             try: