This allows variable references in playbooks in a different way.

This commit is contained in:
Michael DeHaan
2013-10-30 21:26:16 -04:00
parent b5c9d5a59b
commit 90cce35919
3 changed files with 17 additions and 1 deletions

View File

@@ -917,11 +917,17 @@ def safe_eval(str, locals=None, include_exceptions=False, template_call=False):
# do not allow method calls to modules
if not isinstance(str, basestring):
# already templated to a datastructure, perhaps?
if include_exceptions:
return (str, None)
return str
if re.search(r'\w\.\w+\(', str):
if include_exceptions:
return (str, None)
return str
# do not allow imports
if re.search(r'import \w+', str):
if include_exceptions:
return (str, None)
return str
try:
result = None