New collection --pre handling breaks on empty list
lod opened this issue · 2 comments
lod commented
Recent commit ansible/ansible-compat@0181df0 loops through the collections list on https://github.com/ansible/ansible-compat/blob/main/src/ansible_compat/runtime.py#L558
A requirements.yml file like this
---
collections:
Is parsed by the yaml parser as {'collections': None}
Which causes this error
File "/usr/local/lib/python3.11/dist-packages/ansible_compat/runtime.py", line 609, in prepare_environment
self.install_requirements(Path(req_file), retry=retry, offline=offline)
File "/usr/local/lib/python3.11/dist-packages/ansible_compat/runtime.py", line 558, in install_requirements
for collection in reqs_yaml["collections"]:
TypeError: 'NoneType' object is not iterable
Trivial to work around once I discovered I had an empty roles/requirements.yml file.
lod commented
Fixed in ansible/ansible-compat#332