mirror of
https://github.com/ansible/ansible.git
synced 2026-08-05 16:13:06 +02:00
fix issue with legacy pugins and no docs (#78686)
* fix issue with legacy pugins and no docs
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- ansible-doc will not traceback when legacy plugins don't have docs nor adjacent file with docs
|
||||
@@ -340,7 +340,8 @@ def get_plugin_docs(plugin, plugin_type, loader, fragment_loader, verbose):
|
||||
if not docs[0]:
|
||||
try:
|
||||
newfile = _find_adjacent(filename, plugin, C.DOC_EXTENSIONS)
|
||||
docs = get_docstring(newfile, fragment_loader, verbose=verbose, collection_name=collection_name, plugin_type=plugin_type)
|
||||
if newfile:
|
||||
docs = get_docstring(newfile, fragment_loader, verbose=verbose, collection_name=collection_name, plugin_type=plugin_type)
|
||||
except Exception as e:
|
||||
raise AnsibleParserError('Adjacent file %s did not contain a DOCUMENTATION attribute (%s)' % (plugin, filename), orig_exc=e)
|
||||
|
||||
|
||||
@@ -19,4 +19,5 @@ class FilterModule(object):
|
||||
def filters(self):
|
||||
return {
|
||||
'donothing': donothing,
|
||||
'nodocs': donothing,
|
||||
}
|
||||
|
||||
@@ -160,6 +160,9 @@ count=$(ANSIBLE_LIBRARY='./nolibrary' ansible-doc -l ansible.builtin |wc -l)
|
||||
[ "$(ansible-doc -t filter --playbook-dir ./ donothing| wc -l)" -gt "0" ]
|
||||
[ "$(ansible-doc -t filter --playbook-dir ./ ansible.legacy.donothing| wc -l)" -gt "0" ]
|
||||
|
||||
# no docs and no sidecar
|
||||
ansible-doc -t filter --playbook-dir ./ nodocs 2>&1| grep -c 'missing documentation' || true
|
||||
|
||||
# produce 'sidecar' docs for module
|
||||
[ "$(ansible-doc -M ./library test_win_module| wc -l)" -gt "0" ]
|
||||
[ "$(ansible-doc --playbook-dir ./ test_win_module| wc -l)" -gt "0" ]
|
||||
|
||||
Reference in New Issue
Block a user