1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #11733 from amenonsen/csvfile

v2 breakage: lookupfile should lookup the given file=xxx
This commit is contained in:
Brian Coca 2015-07-25 11:53:22 -04:00
commit 5be384bab0
2 changed files with 5 additions and 2 deletions

View file

@ -75,7 +75,7 @@ class LookupModule(LookupBase):
if paramvals['delimiter'] == 'TAB': if paramvals['delimiter'] == 'TAB':
paramvals['delimiter'] = "\t" paramvals['delimiter'] = "\t"
lookupfile = self._loader.path_dwim_relative(basedir, 'files', term) lookupfile = self._loader.path_dwim_relative(basedir, 'files', paramvals['file'])
var = self.read_csv(lookupfile, key, paramvals['delimiter'], paramvals['default'], paramvals['col']) var = self.read_csv(lookupfile, key, paramvals['delimiter'], paramvals['default'], paramvals['col'])
if var is not None: if var is not None:
if type(var) is list: if type(var) is list:

View file

@ -63,6 +63,9 @@ class LookupModule(object):
for param in params[1:]: for param in params[1:]:
name, value = param.split('=') name, value = param.split('=')
assert(name in paramvals) assert(name in paramvals)
if name == 'delimiter':
paramvals[name] = str(value)
else:
paramvals[name] = value paramvals[name] = value
except (ValueError, AssertionError), e: except (ValueError, AssertionError), e:
raise errors.AnsibleError(e) raise errors.AnsibleError(e)