mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
simplified and normalized lookup search path behaviour
This commit is contained in:
@@ -46,6 +46,12 @@ class LookupModule(LookupBase):
|
||||
terms = [ terms ]
|
||||
|
||||
ret = []
|
||||
|
||||
if 'role_path' in variables:
|
||||
basedir = variables['role_path']
|
||||
else:
|
||||
basedir = self._loader.get_basedir()
|
||||
|
||||
for term in terms:
|
||||
params = term.split()
|
||||
key = params[0]
|
||||
@@ -69,9 +75,8 @@ class LookupModule(LookupBase):
|
||||
if paramvals['delimiter'] == 'TAB':
|
||||
paramvals['delimiter'] = "\t"
|
||||
|
||||
path = self._loader.path_dwim(paramvals['file'])
|
||||
|
||||
var = self.read_csv(path, key, paramvals['delimiter'], paramvals['default'], paramvals['col'])
|
||||
lookupfile = self._loader.path_dwim_relative(basedir, 'files', term)
|
||||
var = self.read_csv(lookupfile, key, paramvals['delimiter'], paramvals['default'], paramvals['col'])
|
||||
if var is not None:
|
||||
if type(var) is list:
|
||||
for v in var:
|
||||
|
||||
Reference in New Issue
Block a user