mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
removed cruft
made sure it does not fail on undefined
This commit is contained in:
parent
f29c1c7452
commit
7291f9e965
1 changed files with 5 additions and 6 deletions
|
@ -19,24 +19,23 @@
|
|||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
from six import iteritems, string_types
|
||||
|
||||
import re
|
||||
|
||||
from ansible.template import Templar
|
||||
from ansible.template.safe_eval import safe_eval
|
||||
|
||||
__all__ = ['listify_lookup_plugin_terms']
|
||||
|
||||
LOOKUP_REGEX = re.compile(r'lookup\s*\(')
|
||||
|
||||
#FIXME: probably just move this into lookup plugin base class
|
||||
def listify_lookup_plugin_terms(terms, variables, loader):
|
||||
|
||||
if isinstance(terms, basestring):
|
||||
stripped = terms.strip()
|
||||
templar = Templar(loader=loader, variables=variables)
|
||||
terms = templar.template(terms, convert_bare=True)
|
||||
|
||||
#FIXME: warn/deprecation on bare vars in with_ so we can eventually remove fail on undefined override
|
||||
terms = templar.template(terms, convert_bare=True, fail_on_undefined=False)
|
||||
|
||||
#TODO: check if this is needed as template should also return correct type already
|
||||
terms = safe_eval(terms)
|
||||
|
||||
if isinstance(terms, basestring):
|
||||
|
|
Loading…
Add table
Reference in a new issue