mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-27 07:01:22 -07: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:
parent
eefe359d6b
commit
d52a9cee46
1 changed files with 1 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue