diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 2b7f782e56f0af0afb9e19f710a890ec4b098dac..6212cfa4600b605ac29aba292b8321153b19449e 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -15,7 +15,7 @@ jobs: - name: Run ansible-doc-test run: | python -m pip install "ansible < 2.10" - ANSIBLE_LIBRARY="." python utils/ansible-doc-test roles plugins + ANSIBLE_LIBRARY="." python utils/ansible-doc-test -v roles plugins check_docs_latest: name: Check Ansible Documentation with latest Ansible. @@ -28,5 +28,5 @@ jobs: - name: Run ansible-doc-test run: | python -m pip install ansible - ANSIBLE_LIBRARY="." python utils/ansible-doc-test roles plugins + ANSIBLE_LIBRARY="." python utils/ansible-doc-test -v roles plugins diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 671356aff5f7b3eb2fa55ac26af608a0baa566e6..ec90f12ae253e171bb468d3470ecfee9640c456a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,6 +26,6 @@ repos: - id: ansible-doc-test name: Verify Ansible roles and module documentation. language: python - entry: env ANSIBLE_LIBRARY=./plugins/modules utils/ansible-doc-test + entry: utils/ansible-doc-test # args: ['-v', 'roles', 'plugins'] files: ^.*.py$ diff --git a/utils/ansible-doc-test b/utils/ansible-doc-test index 167d1e00d9007493b26a15c0dfac5f251217e24a..1c9095c0cde94e84f0ebd6e87bbdab52f4623d8a 100755 --- a/utils/ansible-doc-test +++ b/utils/ansible-doc-test @@ -29,12 +29,16 @@ import subprocess def run_ansible_doc(role, module, verbose=False): playbook_dir, module_path = get_playbook_dir(role, module) + module_dir = os.path.dirname(module_path) - command = ["ansible-doc", + command = ["env", + "ANSIBLE_LIBRARY=%s" % module_dir, + "ansible-doc", "--playbook-dir=%s" % playbook_dir, "--type=module", "-vvv", module] + process = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)