mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Fixing many bugs in v2
* delegate_to rudimentary support (still needs much more work) * lots of other things
This commit is contained in:
parent
402a6d0533
commit
31dd75de59
17 changed files with 144 additions and 124 deletions
|
@ -39,14 +39,11 @@ def listify_lookup_plugin_terms(terms, variables, loader):
|
|||
# with_items: {{ alist }}
|
||||
|
||||
stripped = terms.strip()
|
||||
if not (stripped.startswith('{') or stripped.startswith('[')) and \
|
||||
not stripped.startswith("/") and \
|
||||
not stripped.startswith('set([') and \
|
||||
not LOOKUP_REGEX.search(terms):
|
||||
templar = Templar(loader=loader, variables=variables)
|
||||
if not (stripped.startswith('{') or stripped.startswith('[')) and not stripped.startswith("/") and not stripped.startswith('set([') and not LOOKUP_REGEX.search(terms):
|
||||
# if not already a list, get ready to evaluate with Jinja2
|
||||
# not sure why the "/" is in above code :)
|
||||
try:
|
||||
templar = Templar(loader=loader, variables=variables)
|
||||
new_terms = templar.template("{{ %s }}" % terms)
|
||||
if isinstance(new_terms, basestring) and "{{" in new_terms:
|
||||
pass
|
||||
|
@ -54,6 +51,8 @@ def listify_lookup_plugin_terms(terms, variables, loader):
|
|||
terms = new_terms
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
terms = templar.template(terms)
|
||||
|
||||
if '{' in terms or '[' in terms:
|
||||
# Jinja2 already evaluated a variable to a list.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue