mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 20:31:27 -07: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:
parent
fcca1a124d
commit
2ef8b297ff
6 changed files with 39 additions and 9 deletions
|
@ -330,15 +330,12 @@ class PluginLoader:
|
|||
package = splitname[0]
|
||||
resource = splitname[1]
|
||||
|
||||
append_plugin_type = self.class_name or self.subdir
|
||||
append_plugin_type = self.subdir.replace('_plugins', '')
|
||||
|
||||
if append_plugin_type:
|
||||
# only current non-class special case, module_utils don't use this loader method
|
||||
if append_plugin_type == 'library':
|
||||
append_plugin_type = 'modules'
|
||||
elif append_plugin_type != 'module_utils':
|
||||
append_plugin_type = get_plugin_class(append_plugin_type)
|
||||
package += '.plugins.{0}'.format(append_plugin_type)
|
||||
if append_plugin_type == 'library':
|
||||
append_plugin_type = 'modules'
|
||||
|
||||
package += '.plugins.{0}'.format(append_plugin_type)
|
||||
|
||||
if extension:
|
||||
resource += extension
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue