summaryrefslogtreecommitdiff
path: root/lib/ansible/vars/manager.py
diff options
context:
space:
mode:
authorBrian Coca <bcoca@users.noreply.github.com>2017-10-12 14:57:38 -0400
committerSam Doran <sdoran@ansible.com>2017-10-12 14:57:38 -0400
commit341db894f54dfcaf2d50b000a102822bd3203dbb (patch)
treebc94d609fe6c922866cbdf005ce90b8f17ae7cde /lib/ansible/vars/manager.py
parent840a57a4edbf5a2c71f91cf8bbbb4b2236abbc93 (diff)
downloadansible-341db894f54dfcaf2d50b000a102822bd3203dbb.tar.gz
update delegated var fetching for new 'loop' (#31588)
* update delegated var fetching for new 'loop' * mixed loop/terms
Diffstat (limited to 'lib/ansible/vars/manager.py')
-rw-r--r--lib/ansible/vars/manager.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/ansible/vars/manager.py b/lib/ansible/vars/manager.py
index 4f5e666880..5f27051917 100644
--- a/lib/ansible/vars/manager.py
+++ b/lib/ansible/vars/manager.py
@@ -519,18 +519,20 @@ class VariableManager:
templar = Templar(loader=self._loader, variables=vars_copy)
items = []
- if task.loop is not None:
- if task.loop in lookup_loader:
+ if task.loop_with is not None:
+ if task.loop_with in lookup_loader:
try:
loop_terms = listify_lookup_plugin_terms(terms=task.loop, templar=templar,
loader=self._loader, fail_on_undefined=True, convert_bare=False)
- items = lookup_loader.get(task.loop, loader=self._loader, templar=templar).run(terms=loop_terms, variables=vars_copy)
+ items = lookup_loader.get(task.loop_with, loader=self._loader, templar=templar).run(terms=loop_terms, variables=vars_copy)
except AnsibleUndefinedVariable:
# This task will be skipped later due to this, so we just setup
# a dummy array for the later code so it doesn't fail
items = [None]
else:
- raise AnsibleError("Unexpected failure in finding the lookup named '%s' in the available lookup plugins" % task.loop)
+ raise AnsibleError("Failed to find the lookup named '%s' in the available lookup plugins" % task.loop_with)
+ elif task.loop is not None:
+ items = templar.template(task.loop)
else:
items = [None]