From 2ef8b297ffdb98613b3d64791828e760fb2193c4 Mon Sep 17 00:00:00 2001 From: flowerysong Date: Thu, 2 May 2019 21:15:58 -0400 Subject: 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 --- .../testns/testcoll/plugins/doc_fragments/frag.py | 14 ++++++++++++++ .../testns/testcoll/plugins/modules/testmodule.py | 8 ++++++++ 2 files changed, 22 insertions(+) create mode 100644 test/integration/targets/collections/collection_root_user/ansible_collections/testns/testcoll/plugins/doc_fragments/frag.py (limited to 'test/integration/targets/collections/collection_root_user') diff --git a/test/integration/targets/collections/collection_root_user/ansible_collections/testns/testcoll/plugins/doc_fragments/frag.py b/test/integration/targets/collections/collection_root_user/ansible_collections/testns/testcoll/plugins/doc_fragments/frag.py new file mode 100644 index 0000000000..0ff430b600 --- /dev/null +++ b/test/integration/targets/collections/collection_root_user/ansible_collections/testns/testcoll/plugins/doc_fragments/frag.py @@ -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 +''' diff --git a/test/integration/targets/collections/collection_root_user/ansible_collections/testns/testcoll/plugins/modules/testmodule.py b/test/integration/targets/collections/collection_root_user/ansible_collections/testns/testcoll/plugins/modules/testmodule.py index 58d3152f28..d0220af901 100644 --- a/test/integration/targets/collections/collection_root_user/ansible_collections/testns/testcoll/plugins/modules/testmodule.py +++ b/test/integration/targets/collections/collection_root_user/ansible_collections/testns/testcoll/plugins/modules/testmodule.py @@ -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'))) -- cgit v1.2.3