mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Fix loading namespaced doc_fragments from collections (#55249)
* Fix loading namespaced doc_fragments The syntax for specifying a different fragment name was already using '.' as a separator, so the code needed to be tweaked to avoid choking on names like `testns.testcoll.fragname` and `testns.testcoll.fragname.altvar`. `get_plugin_class()` returns 'docfragment' for the fragment loader; mangling `subdir` provides consistent alignment with the normal plugin directory names and avoids needing special handling of plugin types with 'module' in the name. * Add changelog entry
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
class ModuleDocFragment(object):
|
||||
DOCUMENTATION = r'''
|
||||
options:
|
||||
normal_doc_frag:
|
||||
description:
|
||||
- an option
|
||||
'''
|
||||
|
||||
OTHER_DOCUMENTATION = r'''
|
||||
options:
|
||||
other_doc_frag:
|
||||
description:
|
||||
- another option
|
||||
'''
|
||||
@@ -2,6 +2,14 @@
|
||||
|
||||
import json
|
||||
|
||||
DOCUMENTATION = r'''
|
||||
module: testmodule
|
||||
description: for testing
|
||||
extends_documentation_fragment:
|
||||
- testns.testcoll.frag
|
||||
- testns.testcoll.frag.other_documentation
|
||||
'''
|
||||
|
||||
|
||||
def main():
|
||||
print(json.dumps(dict(changed=False, source='user')))
|
||||
|
||||
@@ -20,6 +20,9 @@ fi
|
||||
# test callback
|
||||
ANSIBLE_CALLBACK_WHITELIST=testns.testcoll.usercallback ansible localhost -m ping | grep "usercallback says ok"
|
||||
|
||||
# test documentation
|
||||
ansible-doc testns.testcoll.testmodule -vvv | grep -- "- normal_doc_frag"
|
||||
|
||||
# we need multiple plays, and conditional import_playbook is noisy and causes problems, so choose here which one to use...
|
||||
if [[ ${INVENTORY_PATH} == *.winrm ]]; then
|
||||
export TEST_PLAYBOOK=windows.yml
|
||||
|
||||
Reference in New Issue
Block a user