Merge pull request #544 from t-woerner/ansible_doc_test__fix_ansible_library

ansible-doc-test: ANSIBLE_LIBRARY needs to be set internally
This commit is contained in:
Rafael Guterres Jeffman
2021-05-19 14:20:51 -03:00
committed by GitHub
3 changed files with 8 additions and 4 deletions

View File

@@ -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

View File

@@ -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$

View File

@@ -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)