diff --git a/lib/ansible/errors/__init__.py b/lib/ansible/errors/__init__.py index 127dd06729f..c866434129e 100644 --- a/lib/ansible/errors/__init__.py +++ b/lib/ansible/errors/__init__.py @@ -95,8 +95,9 @@ class AnsibleError(Exception): self._show_content = False Display().deprecated( - msg=f"The `suppress_extended_error` argument to `{type(self).__name__}` is deprecated. Use `show_content=False` instead.", + msg=f"The `suppress_extended_error` argument to `{type(self).__name__}` is deprecated.", version="2.23", + help_text="Use `show_content=False` instead.", ) @property diff --git a/lib/ansible/plugins/filter/encryption.py b/lib/ansible/plugins/filter/encryption.py index 38d9c0bce3a..78c50422c1c 100644 --- a/lib/ansible/plugins/filter/encryption.py +++ b/lib/ansible/plugins/filter/encryption.py @@ -21,7 +21,11 @@ def do_vault(data, secret, salt=None, vault_id='filter_default', wrap_object=Fal raise TypeError(f"Can only vault strings, instead we got {type(data)}.") if vaultid is not None: - display.deprecated("Use of undocumented 'vaultid', use 'vault_id' instead", version='2.20') + display.deprecated( + msg="Use of undocumented `vaultid`.", + version="2.20", + help_text="Use `vault_id` instead.", + ) if vault_id == 'filter_default': vault_id = vaultid @@ -58,7 +62,11 @@ def do_unvault(vault, secret, vault_id='filter_default', vaultid=None): raise TypeError(f"Vault should be in the form of a string, instead we got {type(vault)}.") if vaultid is not None: - display.deprecated("Use of undocumented 'vaultid', use 'vault_id' instead", version='2.20') + display.deprecated( + msg="Use of undocumented `vaultid`.", + version="2.20", + help_text="Use `vault_id` instead.", + ) if vault_id == 'filter_default': vault_id = vaultid diff --git a/lib/ansible/plugins/shell/powershell.py b/lib/ansible/plugins/shell/powershell.py index 6b5d368cea4..27a65bdeb91 100644 --- a/lib/ansible/plugins/shell/powershell.py +++ b/lib/ansible/plugins/shell/powershell.py @@ -325,8 +325,9 @@ class ShellModule(ShellBase): def checksum(self, path, *args, **kwargs): display.deprecated( - "The 'ShellModule.checksum' method is deprecated. Use 'ActionBase._execute_remote_stat()' instead.", - version="2.23" + msg="The `ShellModule.checksum` method is deprecated.", + version="2.23", + help_text="Use `ActionBase._execute_remote_stat()` instead.", ) path = self._escape(self._unquote(path)) script = """ diff --git a/lib/ansible/plugins/shell/sh.py b/lib/ansible/plugins/shell/sh.py index 3724bf6c7e0..a6817645ece 100644 --- a/lib/ansible/plugins/shell/sh.py +++ b/lib/ansible/plugins/shell/sh.py @@ -48,8 +48,9 @@ class ShellModule(ShellBase): def checksum(self, path, python_interp): display.deprecated( - "The 'ShellModule.checksum' method is deprecated. Use 'ActionBase._execute_remote_stat()' instead.", - version="2.23" + msg="The `ShellModule.checksum` method is deprecated.", + version="2.23", + help_text="Use `ActionBase._execute_remote_stat()` instead.", ) # In the following test, each condition is a check and logical # comparison (|| or &&) that sets the rc value. Every check is run so diff --git a/lib/ansible/utils/py3compat.py b/lib/ansible/utils/py3compat.py index ae3b0702da4..374a3dbcef2 100644 --- a/lib/ansible/utils/py3compat.py +++ b/lib/ansible/utils/py3compat.py @@ -19,8 +19,9 @@ def __getattr__(name): raise AttributeError(name) display.deprecated( - msg='ansible.utils.py3compat.environ is deprecated in favor of os.environ.', + msg='`ansible.utils.py3compat.environ` is deprecated.', version='2.20', + help_text='Use `os.environ` from the Python standard library instead.', ) return os.environ diff --git a/lib/ansible/utils/ssh_functions.py b/lib/ansible/utils/ssh_functions.py index 6a29f1a272f..bbe8982d630 100644 --- a/lib/ansible/utils/ssh_functions.py +++ b/lib/ansible/utils/ssh_functions.py @@ -57,8 +57,9 @@ def set_default_transport(): # deal with 'smart' connection .. one time .. if C.DEFAULT_TRANSPORT == 'smart': display.deprecated( - msg="The 'smart' option for connections is deprecated. Set the connection plugin directly instead.", - version='2.20', + msg="The `smart` option for connections is deprecated.", + version="2.20", + help_text="Set the connection plugin directly instead.", ) # see if SSH can support ControlPersist if not use paramiko diff --git a/lib/ansible/vars/plugins.py b/lib/ansible/vars/plugins.py index 63361da66f2..79dca153a81 100644 --- a/lib/ansible/vars/plugins.py +++ b/lib/ansible/vars/plugins.py @@ -35,10 +35,10 @@ def get_plugin_vars(loader, plugin, path, entities): if hasattr(plugin, 'get_host_vars') or hasattr(plugin, 'get_group_vars'): display.deprecated( msg=f"The vars plugin {plugin.ansible_name} from {plugin._original_path} is relying " - "on the deprecated entrypoints 'get_host_vars' and 'get_group_vars'. " - "This plugin should be updated to inherit from BaseVarsPlugin and define " - "a 'get_vars' method as the main entrypoint instead.", + "on the deprecated entrypoints `get_host_vars` and `get_group_vars`.", version="2.20", + help_text="This plugin should be updated to inherit from `BaseVarsPlugin` and define " + "a `get_vars` method as the main entrypoint instead.", ) try: for entity in entities: diff --git a/test/integration/targets/old_style_vars_plugins/runme.sh b/test/integration/targets/old_style_vars_plugins/runme.sh index ca64f5755b0..2f56e9d0777 100755 --- a/test/integration/targets/old_style_vars_plugins/runme.sh +++ b/test/integration/targets/old_style_vars_plugins/runme.sh @@ -14,7 +14,7 @@ export ANSIBLE_VARS_ENABLED=require_enabled # Test deprecated features export ANSIBLE_VARS_PLUGINS=./deprecation_warning -WARNING="The vars plugin v2_vars_plugin .* is relying on the deprecated entrypoints 'get_host_vars' and 'get_group_vars'" +WARNING="The vars plugin v2_vars_plugin .* is relying on the deprecated entrypoints \`get_host_vars\` and \`get_group_vars\`" ANSIBLE_DEPRECATION_WARNINGS=True ANSIBLE_NOCOLOR=True ANSIBLE_FORCE_COLOR=False \ ansible-inventory -i localhost, --list all "$@" 2> err.txt ansible localhost -m debug -a "msg={{ lookup('file', 'err.txt') | regex_replace('\n', '') }}" | grep "$WARNING"