summaryrefslogtreecommitdiff
path: root/lib/ansible/cli/doc.py
diff options
context:
space:
mode:
authorFelix Fontein <felix@fontein.de>2020-06-10 00:21:19 +0200
committerGitHub <noreply@github.com>2020-06-09 15:21:19 -0700
commita862ff2d4324f871565ef5b749c6a96ad0ad767e (patch)
tree2e34f490a9c5f5c9da26e26defb65d33cd2143e9 /lib/ansible/cli/doc.py
parent7bff3d312f21ea1ccb3bc4a1abdb95a0369361f8 (diff)
downloadansible-a862ff2d4324f871565ef5b749c6a96ad0ad767e.tar.gz
Deprecation revisited (#69926)
* Allow to specify collection_name separately for deprecation. * Use new functionality in Ansible. * Use new functionality in tests. * Update tagging/untagging functions. * Update pylint deprecated sanity test. * Update validate-modules. Missing are basic checks for version_added (validate semantic version format for collections). * Improve version validation. Re-add version_added validation. * Make sure collection names are added to return docs before schema validation. * Extra checks to avoid crashes on bad data. * Make C# module utils code work, and update/extend tests. * Add changelog fragment. * Stop extracting collection name from potentially tagged versions/dates. * Simplify C# code. * Update Windows modules docs. * Forgot semicolons.
Diffstat (limited to 'lib/ansible/cli/doc.py')
-rw-r--r--lib/ansible/cli/doc.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/ansible/cli/doc.py b/lib/ansible/cli/doc.py
index fbf0223bac..78e0b17db2 100644
--- a/lib/ansible/cli/doc.py
+++ b/lib/ansible/cli/doc.py
@@ -30,7 +30,12 @@ from ansible.plugins.loader import action_loader, fragment_loader
from ansible.utils.collection_loader import AnsibleCollectionConfig
from ansible.utils.collection_loader._collection_finder import _get_collection_name_from_path
from ansible.utils.display import Display
-from ansible.utils.plugin_docs import BLACKLIST, untag_versions_and_dates, get_docstring, get_versioned_doclink
+from ansible.utils.plugin_docs import (
+ BLACKLIST,
+ remove_current_collection_from_versions_and_dates,
+ get_docstring,
+ get_versioned_doclink,
+)
display = Display()
@@ -330,11 +335,18 @@ class DocCLI(CLI):
raise ValueError('%s did not contain a DOCUMENTATION attribute' % plugin)
doc['filename'] = filename
- untag_versions_and_dates(doc, '%s:' % (collection_name, ), is_module=(plugin_type == 'module'))
return doc, plainexamples, returndocs, metadata
@staticmethod
def format_plugin_doc(plugin, plugin_type, doc, plainexamples, returndocs, metadata):
+ collection_name = 'ansible.builtin'
+ if plugin.startswith('ansible_collections.'):
+ collection_name = '.'.join(plugin.split('.')[1:3])
+
+ # TODO: do we really want this?
+ # add_collection_to_versions_and_dates(doc, '(unknown)', is_module=(plugin_type == 'module'))
+ # remove_current_collection_from_versions_and_dates(doc, collection_name, is_module=(plugin_type == 'module'))
+
# assign from other sections
doc['plainexamples'] = plainexamples
doc['returndocs'] = returndocs