mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
This allows variable references in playbooks in a different way.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user