1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Support late evaluation, suppress warnings on SyntaxError (#17462)

See #14304 comments (https://github.com/ansible/ansible/pull/14304#issuecomment-245453209) for more information.
This commit is contained in:
Dag Wieers 2016-09-09 15:33:23 +02:00 committed by Brian Coca
parent eefe359d6b
commit d52a9cee46

View file

@ -137,9 +137,8 @@ def safe_eval(expr, locals={}, include_exceptions=False):
else:
return result
except SyntaxError as e:
display.warning('SyntaxError in safe_eval() on expr: %s (%s)' % (expr, e))
# special handling for syntax errors, we just return
# the expression string back as-is
# the expression string back as-is to support late evaluation
if include_exceptions:
return (expr, None)
return expr