ansible-doc-test: Set ANSIBLE_LIBRARY using module_dir internally

ANSIBLE_LIBRARY needs to be set properly for new Ansible version 4.0.0
to make sure that it is able to find the module that is checked.

For every file that needs to be checked, there is a separate ansible-doc
call. ANSIBLE_LIBRARY is set using os.path.dirname on the module_path.
This commit is contained in:
Thomas Woerner
2021-05-19 16:01:32 +02:00
parent 86ec69b8c2
commit f8a36d792f

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)