diff options
-rw-r--r-- | changelogs/fragments/deprecated.yml | 3 | ||||
-rwxr-xr-x | lib/ansible/cli/doc.py | 2 | ||||
-rw-r--r-- | lib/ansible/config/manager.py | 4 | ||||
-rw-r--r-- | test/integration/targets/ansible-doc/randommodule-text.output | 2 | ||||
-rwxr-xr-x | test/integration/targets/ansible-doc/runme.sh | 3 |
5 files changed, 11 insertions, 3 deletions
diff --git a/changelogs/fragments/deprecated.yml b/changelogs/fragments/deprecated.yml new file mode 100644 index 0000000000..aa632c0487 --- /dev/null +++ b/changelogs/fragments/deprecated.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - docs - add collection name in message from which the module is being deprecated (https://github.com/ansible/ansible/issues/84116). diff --git a/lib/ansible/cli/doc.py b/lib/ansible/cli/doc.py index af13782990..52ec8a6c7b 100755 --- a/lib/ansible/cli/doc.py +++ b/lib/ansible/cli/doc.py @@ -1396,7 +1396,7 @@ class DocCLI(CLI, RoleMixin): if 'removed_at_date' not in doc['deprecated'] and 'version' in doc['deprecated'] and 'removed_in' not in doc['deprecated']: doc['deprecated']['removed_in'] = doc['deprecated']['version'] try: - text.append('\t' + C.config.get_deprecated_msg_from_config(doc['deprecated'], True)) + text.append('\t' + C.config.get_deprecated_msg_from_config(doc['deprecated'], True, collection_name=collection_name)) except KeyError as e: raise AnsibleError("Invalid deprecation documentation structure", orig_exc=e) else: diff --git a/lib/ansible/config/manager.py b/lib/ansible/config/manager.py index f71613bca6..818219b130 100644 --- a/lib/ansible/config/manager.py +++ b/lib/ansible/config/manager.py @@ -682,12 +682,14 @@ class ConfigManager(object): self._plugins[plugin_type][name] = defs @staticmethod - def get_deprecated_msg_from_config(dep_docs, include_removal=False): + def get_deprecated_msg_from_config(dep_docs, include_removal=False, collection_name=None): removal = '' if include_removal: if 'removed_at_date' in dep_docs: removal = f"Will be removed in a release after {dep_docs['removed_at_date']}\n\t" + elif collection_name: + removal = f"Will be removed in: {collection_name} {dep_docs['removed_in']}\n\t" else: removal = f"Will be removed in: Ansible {dep_docs['removed_in']}\n\t" diff --git a/test/integration/targets/ansible-doc/randommodule-text.output b/test/integration/targets/ansible-doc/randommodule-text.output index e8905165fa..695ffcc3f8 100644 --- a/test/integration/targets/ansible-doc/randommodule-text.output +++ b/test/integration/targets/ansible-doc/randommodule-text.output @@ -12,7 +12,7 @@ messages. DEPRECATED: Reason: Test deprecation - Will be removed in: Ansible 3.0.0 + Will be removed in: testns.testcol 3.0.0 Alternatives: Use some other module OPTIONS (= indicates it is required): diff --git a/test/integration/targets/ansible-doc/runme.sh b/test/integration/targets/ansible-doc/runme.sh index f7accb217c..91da3e854d 100755 --- a/test/integration/targets/ansible-doc/runme.sh +++ b/test/integration/targets/ansible-doc/runme.sh @@ -30,6 +30,9 @@ ansible-doc -t keyword -l | grep "${GREP_OPTS[@]}" 'vars_prompt: list of variabl ansible-doc -t keyword vars_prompt | grep "${GREP_OPTS[@]}" 'description: list of variables to prompt for.' ansible-doc -t keyword asldkfjaslidfhals 2>&1 | grep "${GREP_OPTS[@]}" 'Skipping Invalid keyword' +echo "Check if deprecation collection name is printed" +ansible-doc --playbook-dir ./ testns.testcol.randommodule 2>&1 | grep "${GREP_OPTS[@]}" "Will be removed in: testns.testcol" + # collections testing ( unset ANSIBLE_PLAYBOOK_DIR |