Krikri::PythonLookupRunner
Constants
The wrapper's response kind when the controller python3 cannot
import the ansible package at all - the plugin file itself
(which imports LookupBase at its top level) could never load
either, so the whole mechanism is unavailable and the caller
keeps the old "unknown lookup" behavior.
The controller-side wrapper: imports the plugin file, finds its
LookupModule class (required to subclass the real
ansible.plugins.lookup.LookupBase, exactly like real Ansible's
own loader check), instantiates it with the base class's own
defaults, and calls run(terms, variables=..., **kwargs),
printing the JSON-encoded result. Always responds with a
single-line JSON object ({"ok": true, ...} / {"ok": false, kind,
error}), so a plugin that prints its own noise cannot corrupt the
protocol - only the LAST line of stdout is parsed. An ansible
package the controller python3 cannot import reports kind
"unavailable" (the whole mechanism degrades; the plugin file
could not have imported its own base class either).
Instance methods
Invokes the LookupModule from the plugin source for name with
the resolved terms/kwargs and the current task variables
(real Ansible passes its own vars dict, which conventionally
carries an omit key - see expression_evaluator's call site),
returning the structured result list. Raises LookupError when the
invocation fails (callers degrade to "undefined" only when the
mechanism itself is unavailable - a dispatched failure is a real
lookup error).
A lookup_plugins/<name>.py source for name, searched in the
role's own lookup_plugins/ first, then the playbook-adjacent
one (nearest-first, same convention as
PythonFilterRunner#find_sources). Unlike filters - whose names
come from each FilterModule's filters() dict - real Ansible's
plugin loader derives a lookup plugin's name from its FILE NAME,
so no Python introspection (and no mtime cache) is needed here:
lookup_plugins/manala_environment_files.py IS the
manala_environment_files lookup, whatever class it declares.
The CONTROLLER's own python3 - the interpreter real Ansible needs on the controller anyway (same detection pattern as PythonFilterRunner#python_executable).