mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
simplified and normalized lookup search path behaviour
This commit is contained in:
parent
857f584ebf
commit
b678b9828c
3 changed files with 33 additions and 26 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue