mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
empty lines in csvfile means row has no items in list; check row len first. (#40089)
This commit is contained in:
parent
25a48fb89e
commit
0b3ed626b3
1 changed files with 1 additions and 1 deletions
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue