mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
stop passing loader/dataloader since it has been deprecated by ansible (#6074)
* stop passing loader/dataloader since it has been deprecated by ansible Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com> * add changelog fragment Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com> * explicitly pass None to keep compatibility to older Ansible versions Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com> * use try/except to keep things compatible Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com> * Update plugins/lookup/cartesian.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/lookup/flattened.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/lookup/flattened.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/lookup/cartesian.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update changelogs/fragments/6074-loader_in_listify.yml.yml Co-authored-by: Felix Fontein <felix@fontein.de> --------- Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
7d3e6d1bb7
commit
b64929118e
3 changed files with 14 additions and 2 deletions
2
changelogs/fragments/6074-loader_in_listify.yml.yml
Normal file
2
changelogs/fragments/6074-loader_in_listify.yml.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- cartesian and flattened lookup plugins - adjust to parameter deprecation in ansible-core 2.14's ``listify_lookup_plugin_terms`` helper function (https://github.com/ansible-collections/community.general/pull/6074).
|
|
@ -66,6 +66,11 @@ class LookupModule(LookupBase):
|
|||
"""
|
||||
results = []
|
||||
for x in terms:
|
||||
try:
|
||||
intermediate = listify_lookup_plugin_terms(x, templar=self._templar)
|
||||
except TypeError:
|
||||
# The loader argument is deprecated in ansible-core 2.14+. Fall back to
|
||||
# pre-2.14 behavior for older ansible-core versions.
|
||||
intermediate = listify_lookup_plugin_terms(x, templar=self._templar, loader=self._loader)
|
||||
results.append(intermediate)
|
||||
return results
|
||||
|
|
|
@ -67,6 +67,11 @@ class LookupModule(LookupBase):
|
|||
|
||||
if isinstance(term, string_types):
|
||||
# convert a variable to a list
|
||||
try:
|
||||
term2 = listify_lookup_plugin_terms(term, templar=self._templar)
|
||||
except TypeError:
|
||||
# The loader argument is deprecated in ansible-core 2.14+. Fall back to
|
||||
# pre-2.14 behavior for older ansible-core versions.
|
||||
term2 = listify_lookup_plugin_terms(term, templar=self._templar, loader=self._loader)
|
||||
# but avoid converting a plain string to a list of one string
|
||||
if term2 != [term]:
|
||||
|
|
Loading…
Reference in a new issue