mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
remove bare vars and undefined from lookup lists (#17647)
https://docs.ansible.com/ansible/porting_guide_2.0.html#deprecated
This commit is contained in:
parent
3550f73837
commit
cf7822e201
2 changed files with 2 additions and 4 deletions
|
@ -28,10 +28,9 @@ from ansible.template.safe_eval import safe_eval
|
|||
|
||||
__all__ = ['listify_lookup_plugin_terms']
|
||||
|
||||
def listify_lookup_plugin_terms(terms, templar, loader, fail_on_undefined=False, convert_bare=True):
|
||||
def listify_lookup_plugin_terms(terms, templar, loader, fail_on_undefined=True, convert_bare=False):
|
||||
|
||||
if isinstance(terms, string_types):
|
||||
# TODO: warn/deprecation on bare vars in with_ so we can eventually remove fail on undefined override
|
||||
terms = templar.template(terms.strip(), convert_bare=convert_bare, fail_on_undefined=fail_on_undefined)
|
||||
else:
|
||||
terms = templar.template(terms, fail_on_undefined=fail_on_undefined)
|
||||
|
|
|
@ -439,8 +439,7 @@ class VariableManager:
|
|||
if task.loop is not None:
|
||||
if task.loop in lookup_loader:
|
||||
try:
|
||||
#TODO: remove convert_bare true and deprecate this in with_
|
||||
loop_terms = listify_lookup_plugin_terms(terms=task.loop_args, templar=templar, loader=loader, fail_on_undefined=True, convert_bare=True)
|
||||
loop_terms = listify_lookup_plugin_terms(terms=task.loop_args, templar=templar, loader=loader, fail_on_undefined=True, convert_bare=False)
|
||||
items = lookup_loader.get(task.loop, loader=loader, templar=templar).run(terms=loop_terms, variables=vars_copy)
|
||||
except AnsibleUndefinedVariable as e:
|
||||
# This task will be skipped later due to this, so we just setup
|
||||
|
|
Loading…
Reference in a new issue