ansible-community / antsibull-docs

Tooling for building Ansible documentation
https://ansible.readthedocs.io/projects/antsibull-docs/
GNU General Public License v3.0
28 stars 17 forks source link

antsibull-docs does not always use the collection_path configured in ansible #343

Open ssbarnea opened 2 weeks ago

ssbarnea commented 2 weeks ago

I detected a bug where antsibull-docs collection command will ignore a collection path configured inside ansible.cfg file. Apparently current logic implemented is to only recognize the environment variables overrides but fails to ask ansible about effective collection path used, ansible-config dump being the most effective way to report it (but even ansible --version would report it)

$ ansible-config dump|grep COLLECTIONS_PATHS
COLLECTIONS_PATHS(/Volumes/code/a/ansible_collections/ansible/eda/ansible.cfg) = ['/Volumes/code/a/ansible_collections/ansible/eda/collections']

Based on my debugging the issue seems to be caused by https://github.com/ansible-community/antsibull-docs/blob/f866406977f3cf0f3287f7afd9c2b22f2a155f46/src/antsibull_docs/docs_parsing/__init__.py#L53

The issue is not critical as defining ANSIBLE_COLLECTIONS_PATH=... before calling the tool can be used as a workaround for forcing it to look elsewhere.

felixfontein commented 2 weeks ago

antsibull-docs does not use ansible.cfg at all. That is a file used by ansible-core. So I don't see what ansible.cfg has to do with antsibull-docs.

Since you do not describe the situation in which you use antsibull-docs and encoutner this it is impossible to say anything about this, since the behavior of antsibull-docs varies greatly depending on the subcommand and the parameters passed.

felixfontein commented 2 weeks ago

@ssbarnea can you please add the missing information? Thanks.