now only flattened ignores failonundefined cause of it's special need
parent
e3feb104c3
commit
db145a368d
|
@ -50,7 +50,7 @@ class LookupModule(object):
|
||||||
|
|
||||||
if isinstance(term, basestring):
|
if isinstance(term, basestring):
|
||||||
# convert a variable to a list
|
# convert a variable to a list
|
||||||
term2 = utils.listify_lookup_plugin_terms(term, self.basedir, inject)
|
term2 = utils.listify_lookup_plugin_terms(term, self.basedir, inject, fail_on_undefined=False)
|
||||||
# but avoid converting a plain string to a list of one string
|
# but avoid converting a plain string to a list of one string
|
||||||
if term2 != [ term ]:
|
if term2 != [ term ]:
|
||||||
term = term2
|
term = term2
|
||||||
|
|
|
@ -1451,7 +1451,7 @@ def safe_eval(expr, locals={}, include_exceptions=False):
|
||||||
return expr
|
return expr
|
||||||
|
|
||||||
|
|
||||||
def listify_lookup_plugin_terms(terms, basedir, inject):
|
def listify_lookup_plugin_terms(terms, basedir, inject, fail_on_undefined=C.DEFAULT_UNDEFINED_VAR_BEHAVIOR):
|
||||||
|
|
||||||
from ansible.utils import template
|
from ansible.utils import template
|
||||||
|
|
||||||
|
@ -1469,7 +1469,7 @@ def listify_lookup_plugin_terms(terms, basedir, inject):
|
||||||
# if not already a list, get ready to evaluate with Jinja2
|
# if not already a list, get ready to evaluate with Jinja2
|
||||||
# not sure why the "/" is in above code :)
|
# not sure why the "/" is in above code :)
|
||||||
try:
|
try:
|
||||||
new_terms = template.template(basedir, "{{%s}}" % terms, inject, convert_bare=True)
|
new_terms = template.template(basedir, "{{%s}}" % terms, inject, convert_bare=True, fail_on_undefined=fail_on_undefined)
|
||||||
if isinstance(new_terms, basestring) and "{{" in new_terms:
|
if isinstance(new_terms, basestring) and "{{" in new_terms:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue