[PR #6074/b6492911 backport][stable-5] stop passing loader/dataloader since it has been deprecated by ansible (#6091)

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>
(cherry picked from commit b64929118e)

Co-authored-by: schurzi <github@drachen-server.de>
This commit is contained in:
patchback[bot] 2023-02-25 15:39:43 +01:00 committed by GitHub
parent c3b1a3a873
commit 51bf8ed298
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View file

@ -64,7 +64,12 @@ class LookupModule(LookupBase):
"""
results = []
for x in terms:
intermediate = listify_lookup_plugin_terms(x, templar=self._templar, loader=self._loader)
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