mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
empty lines in csvfile means row has no items in list; check row len first. (#40089)
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user