From 1705ec98cd2eedbcf53cf20c52de007b4dfe5bab Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Tue, 15 Nov 2022 16:03:47 +0100 Subject: [PATCH] ansible-doc and validate-modules: remove underscore deprecation handling for collections (#79362) * Remove underscore deprecation handling for collections. * Also consider ansible.legacy. --- changelogs/fragments/79362-validate-modules-underscore.yml | 6 ++++++ lib/ansible/cli/doc.py | 4 +++- .../sanity/validate-modules/validate_modules/schema.py | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/79362-validate-modules-underscore.yml diff --git a/changelogs/fragments/79362-validate-modules-underscore.yml b/changelogs/fragments/79362-validate-modules-underscore.yml new file mode 100644 index 00000000000..c3bc21c5068 --- /dev/null +++ b/changelogs/fragments/79362-validate-modules-underscore.yml @@ -0,0 +1,6 @@ +breaking_changes: + - "ansible-doc - no longer treat plugins in collections whose name starts with ``_`` as deprecated + (https://github.com/ansible/ansible/pull/79217)." + - "ansible-test sanity - previously plugins and modules in collections whose name started with ``_`` + were treated as deprecated, even when they were not marked as deprecated in ``meta/runtime.yml``. + This is no longer the case (https://github.com/ansible/ansible/pull/79362)." diff --git a/lib/ansible/cli/doc.py b/lib/ansible/cli/doc.py index 803653038aa..a43cb3307f6 100755 --- a/lib/ansible/cli/doc.py +++ b/lib/ansible/cli/doc.py @@ -495,7 +495,9 @@ class DocCLI(CLI, RoleMixin): desc = desc[:linelimit] + '...' pbreak = plugin.split('.') - if pbreak[-1].startswith('_'): # Handle deprecated # TODO: add mark for deprecated collection plugins + # TODO: add mark for deprecated collection plugins + if pbreak[-1].startswith('_') and plugin.startswith(('ansible.builtin.', 'ansible.legacy.')): + # Handle deprecated ansible.builtin plugins pbreak[-1] = pbreak[-1][1:] plugin = '.'.join(pbreak) deprecated.append("%-*s %-*.*s" % (displace, plugin, linelimit, len(desc), desc)) diff --git a/test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/schema.py b/test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/schema.py index de387eef8cb..3de3a4fda50 100644 --- a/test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/schema.py +++ b/test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/schema.py @@ -794,7 +794,7 @@ def author(value): def doc_schema(module_name, for_collection=False, deprecated_module=False, plugin_type='module'): - if module_name.startswith('_'): + if module_name.startswith('_') and not for_collection: module_name = module_name[1:] deprecated_module = True if for_collection is False and plugin_type == 'connection' and module_name == 'paramiko_ssh':