New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
custom lookup plugin found with ansible-doc but not found in playbook #66464
Comments
Files identified in the description: If these files are inaccurate, please update the |
Doing For diff --git a/lib/ansible/template/__init__.py b/lib/ansible/template/__init__.py
index 062c4d6889..7cea02bc77 100644
--- a/lib/ansible/template/__init__.py
+++ b/lib/ansible/template/__init__.py
@@ -749,7 +749,7 @@ class Templar:
return self._lookup(name, *args, **kwargs)
def _lookup(self, name, *args, **kwargs):
- instance = self._lookup_loader.get(name.lower(), loader=self._loader, templar=self)
+ instance = self._lookup_loader.get(name, loader=self._loader, templar=self)
if instance is not None:
wantlist = kwargs.pop('wantlist', False) Having said that I am not sure as to why the behavior is different for each of the above or if it is intended. |
Yes, it was a case sensitivity issue. I confirmed that changing the file name to listfolders.py allowed my playbook to pick up the plugin correctly. It looks to me that your fix would bring consistency to all 3 functions: Thanks for the quick response! |
all 3 should be case sensitive, seems |
This brings consistency to lookup(), with_ and ansible-doc. Fixes ansible#66464
This brings consistency to lookup(), with_ and ansible-doc. Fixes #66464 * Add a porting guide entry
This brings consistency to lookup(), with_ and ansible-doc. Fixes ansible#66464 * Add a porting guide entry
SUMMARY
Custom lookup plugin appears correctly configured using
ansible-doc -t lookup listFolders
however always results inFAILED! => {"msg": "lookup plugin (listFolders) not found"}
when used in playbook.ISSUE TYPE
COMPONENT NAME
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
Here is a trivial custom lookup plugin that just contains documentation to test my configuration.
It is placed in /Users/xxxx/.ansible/plugins/lookup/listFolders.py
This command correctly pics up the lookup plugin:
ansible-doc -t lookup listFolders
And shows the output:
However in a playbook I always hit this error:
fatal: [localhost]: FAILED! => {"msg": "lookup plugin (listFolders) not found"}
Here is a sample playbook that produces the error:
EXPECTED RESULTS
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: