From f9a737b9b2b21a9de142ea7fb1d33875bca00e6e Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Fri, 17 Jul 2020 19:58:54 +0200 Subject: [PATCH] Top-level deprecation of plugin did not get collection_name added when deprecating by version (#70344) (#70370) * Top-level deprecation of plugin did not get collection_name added when deprecating by version. * Add changelog fragment. (cherry picked from commit 689cfd198351e00128dec85dde8a3d7243ed8dc6) --- .../70344-plugin-deprecation-collection-name.yml | 2 ++ lib/ansible/utils/plugin_docs.py | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 changelogs/fragments/70344-plugin-deprecation-collection-name.yml diff --git a/changelogs/fragments/70344-plugin-deprecation-collection-name.yml b/changelogs/fragments/70344-plugin-deprecation-collection-name.yml new file mode 100644 index 00000000000..e3884158fb9 --- /dev/null +++ b/changelogs/fragments/70344-plugin-deprecation-collection-name.yml @@ -0,0 +1,2 @@ +bugfixes: +- "ansible-doc - collection name for plugin top-level deprecation was not inserted when deprecating by version (https://github.com/ansible/ansible/pull/70344)." diff --git a/lib/ansible/utils/plugin_docs.py b/lib/ansible/utils/plugin_docs.py index 02c6fb46363..83c670cc4d3 100644 --- a/lib/ansible/utils/plugin_docs.py +++ b/lib/ansible/utils/plugin_docs.py @@ -41,14 +41,14 @@ def merge_fragment(target, source): def _process_versions_and_dates(fragment, is_module, return_docs, callback): - def process_deprecation(deprecation): + def process_deprecation(deprecation, top_level=False): if not isinstance(deprecation, MutableMapping): return - if is_module and 'removed_in' in deprecation: # used in module deprecations + if (is_module or top_level) and 'removed_in' in deprecation: # used in module deprecations callback(deprecation, 'removed_in', 'removed_from_collection') if 'removed_at_date' in deprecation: callback(deprecation, 'removed_at_date', 'removed_from_collection') - if not is_module and 'version' in deprecation: # used in plugin option deprecations + if not (is_module or top_level) and 'version' in deprecation: # used in plugin option deprecations callback(deprecation, 'version', 'removed_from_collection') def process_option_specifiers(specifiers): @@ -95,7 +95,7 @@ def _process_versions_and_dates(fragment, is_module, return_docs, callback): if 'version_added' in fragment: callback(fragment, 'version_added', 'version_added_collection') if isinstance(fragment.get('deprecated'), MutableMapping): - process_deprecation(fragment['deprecated']) + process_deprecation(fragment['deprecated'], top_level=True) if isinstance(fragment.get('options'), MutableMapping): process_options(fragment['options'])