empty lines in csvfile means row has no items in list; check row len first. (#40089)

This commit is contained in:
vigiroux 2018-05-15 18:26:53 -04:00 committed by Adam Miller
parent 25a48fb89e
commit 0b3ed626b3

View file

@ -106,7 +106,7 @@ class LookupModule(LookupBase):
creader = CSVReader(f, delimiter=to_native(delimiter), encoding=encoding)
for row in creader:
if row[0] == key:
if len(row) and row[0] == key:
return row[int(col)]
except Exception as e:
raise AnsibleError("csvfile: %s" % to_native(e))