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

See #14304 comments (https://github.com/ansible/ansible/pull/14304#issuecomment-245453209) for more information.
pull/17483/head
Dag Wieers 8 years ago committed by Brian Coca
parent eefe359d6b
commit d52a9cee46

@ -137,9 +137,8 @@ def safe_eval(expr, locals={}, include_exceptions=False):
else: else:
return result return result
except SyntaxError as e: except SyntaxError as e:
display.warning('SyntaxError in safe_eval() on expr: %s (%s)' % (expr, e))
# special handling for syntax errors, we just return # 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: if include_exceptions:
return (expr, None) return (expr, None)
return expr return expr

Loading…
Cancel
Save