mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-04 15:29:10 -07:00
Port lookup plugins to global display.
This commit is contained in:
parent
4c7128da17
commit
b05d0b8c9c
4 changed files with 31 additions and 6 deletions
|
@ -23,6 +23,14 @@ from ansible import constants as C
|
|||
from ansible.errors import AnsibleError
|
||||
from ansible.plugins.lookup import LookupBase
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
display = display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
|
||||
|
||||
class LookupModule(LookupBase):
|
||||
|
||||
def run(self, terms, variables, **kwargs):
|
||||
|
@ -32,10 +40,10 @@ class LookupModule(LookupBase):
|
|||
ret = []
|
||||
|
||||
for term in terms:
|
||||
self._display.debug("File lookup term: %s" % term)
|
||||
display.debug("File lookup term: %s" % term)
|
||||
|
||||
lookupfile = self._loader.path_dwim_relative(basedir, 'templates', term)
|
||||
self._display.vvvv("File lookup using %s as file" % lookupfile)
|
||||
display.vvvv("File lookup using %s as file" % lookupfile)
|
||||
if lookupfile and os.path.exists(lookupfile):
|
||||
with open(lookupfile, 'r') as f:
|
||||
template_data = f.read()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue