ansible-doc: ignore plugin deprecation warnings (#75674)

Fixes #75671
pull/75951/head
Martin Krizek 3 years ago committed by GitHub
parent 8cef40f839
commit 23b9d197eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- ansible-doc - ignore plugin deprecation warnings (https://github.com/ansible/ansible/issues/75671)

@ -449,7 +449,7 @@ class PluginLoader:
entry = collection_meta.get('plugin_routing', {}).get(plugin_type, {}).get(subdir_qualified_resource, None) entry = collection_meta.get('plugin_routing', {}).get(plugin_type, {}).get(subdir_qualified_resource, None)
return entry return entry
def _find_fq_plugin(self, fq_name, extension, plugin_load_context): def _find_fq_plugin(self, fq_name, extension, plugin_load_context, ignore_deprecated=False):
"""Search builtin paths to find a plugin. No external paths are searched, """Search builtin paths to find a plugin. No external paths are searched,
meaning plugins inside roles inside collections will be ignored. meaning plugins inside roles inside collections will be ignored.
""" """
@ -468,7 +468,8 @@ class PluginLoader:
deprecation = routing_metadata.get('deprecation', None) deprecation = routing_metadata.get('deprecation', None)
# this will no-op if there's no deprecation metadata for this plugin # this will no-op if there's no deprecation metadata for this plugin
plugin_load_context.record_deprecation(fq_name, deprecation, acr.collection) if not ignore_deprecated:
plugin_load_context.record_deprecation(fq_name, deprecation, acr.collection)
tombstone = routing_metadata.get('tombstone', None) tombstone = routing_metadata.get('tombstone', None)
@ -622,7 +623,8 @@ class PluginLoader:
plugin_load_context, ignore_deprecated, check_aliases, suffix) plugin_load_context, ignore_deprecated, check_aliases, suffix)
else: else:
# 'ansible.builtin' should be handled here. This means only internal, or builtin, paths are searched. # 'ansible.builtin' should be handled here. This means only internal, or builtin, paths are searched.
plugin_load_context = self._find_fq_plugin(candidate_name, suffix, plugin_load_context=plugin_load_context) plugin_load_context = self._find_fq_plugin(candidate_name, suffix, plugin_load_context=plugin_load_context,
ignore_deprecated=ignore_deprecated)
# Pending redirects are added to the redirect_list at the beginning of _resolve_plugin_step. # Pending redirects are added to the redirect_list at the beginning of _resolve_plugin_step.
# Once redirects are resolved, ensure the final FQCN is added here. # Once redirects are resolved, ensure the final FQCN is added here.
@ -754,7 +756,8 @@ class PluginLoader:
# last ditch, if it's something that can be redirected, look for a builtin redirect before giving up # last ditch, if it's something that can be redirected, look for a builtin redirect before giving up
candidate_fqcr = 'ansible.builtin.{0}'.format(name) candidate_fqcr = 'ansible.builtin.{0}'.format(name)
if '.' not in name and AnsibleCollectionRef.is_valid_fqcr(candidate_fqcr): if '.' not in name and AnsibleCollectionRef.is_valid_fqcr(candidate_fqcr):
return self._find_fq_plugin(fq_name=candidate_fqcr, extension=suffix, plugin_load_context=plugin_load_context) return self._find_fq_plugin(fq_name=candidate_fqcr, extension=suffix, plugin_load_context=plugin_load_context,
ignore_deprecated=ignore_deprecated)
return plugin_load_context.nope('{0} is not eligible for last-chance resolution'.format(name)) return plugin_load_context.nope('{0} is not eligible for last-chance resolution'.format(name))

Loading…
Cancel
Save