mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-28 03:00:23 -07:00
Use safe_eval vs eval.
This commit is contained in:
parent
fecfbf9226
commit
a83e10d77d
2 changed files with 30 additions and 2 deletions
|
@ -15,6 +15,8 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from ansible.utils import safe_eval
|
||||
|
||||
def flatten(terms):
|
||||
ret = []
|
||||
for term in terms:
|
||||
|
@ -34,7 +36,7 @@ class LookupModule(object):
|
|||
if '{' or '[' in terms:
|
||||
# Jinja2-ified list needs to be converted back to a real type
|
||||
# TODO: something a bit less heavy than eval
|
||||
terms = eval(terms)
|
||||
terms = safe_eval(terms)
|
||||
terms = [ terms ]
|
||||
return flatten(terms)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue