mirror of
https://github.com/ansible/ansible.git
synced 2026-08-06 16:12:27 +02:00
Fix calls to deprecated() to include help_text arg (#85262)
Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit ea7ad90c31)
This commit is contained in:
committed by
Matt Davis
parent
36f322bb2c
commit
9f703f7633
@@ -95,8 +95,9 @@ class AnsibleError(Exception):
|
|||||||
self._show_content = False
|
self._show_content = False
|
||||||
|
|
||||||
Display().deprecated(
|
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",
|
version="2.23",
|
||||||
|
help_text="Use `show_content=False` instead.",
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
@@ -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)}.")
|
raise TypeError(f"Can only vault strings, instead we got {type(data)}.")
|
||||||
|
|
||||||
if vaultid is not None:
|
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':
|
if vault_id == 'filter_default':
|
||||||
vault_id = vaultid
|
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)}.")
|
raise TypeError(f"Vault should be in the form of a string, instead we got {type(vault)}.")
|
||||||
|
|
||||||
if vaultid is not None:
|
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':
|
if vault_id == 'filter_default':
|
||||||
vault_id = vaultid
|
vault_id = vaultid
|
||||||
|
|||||||
@@ -325,8 +325,9 @@ class ShellModule(ShellBase):
|
|||||||
|
|
||||||
def checksum(self, path, *args, **kwargs):
|
def checksum(self, path, *args, **kwargs):
|
||||||
display.deprecated(
|
display.deprecated(
|
||||||
"The 'ShellModule.checksum' method is deprecated. Use 'ActionBase._execute_remote_stat()' instead.",
|
msg="The `ShellModule.checksum` method is deprecated.",
|
||||||
version="2.23"
|
version="2.23",
|
||||||
|
help_text="Use `ActionBase._execute_remote_stat()` instead.",
|
||||||
)
|
)
|
||||||
path = self._escape(self._unquote(path))
|
path = self._escape(self._unquote(path))
|
||||||
script = """
|
script = """
|
||||||
|
|||||||
@@ -48,8 +48,9 @@ class ShellModule(ShellBase):
|
|||||||
|
|
||||||
def checksum(self, path, python_interp):
|
def checksum(self, path, python_interp):
|
||||||
display.deprecated(
|
display.deprecated(
|
||||||
"The 'ShellModule.checksum' method is deprecated. Use 'ActionBase._execute_remote_stat()' instead.",
|
msg="The `ShellModule.checksum` method is deprecated.",
|
||||||
version="2.23"
|
version="2.23",
|
||||||
|
help_text="Use `ActionBase._execute_remote_stat()` instead.",
|
||||||
)
|
)
|
||||||
# In the following test, each condition is a check and logical
|
# In the following test, each condition is a check and logical
|
||||||
# comparison (|| or &&) that sets the rc value. Every check is run so
|
# comparison (|| or &&) that sets the rc value. Every check is run so
|
||||||
|
|||||||
@@ -19,8 +19,9 @@ def __getattr__(name):
|
|||||||
raise AttributeError(name)
|
raise AttributeError(name)
|
||||||
|
|
||||||
display.deprecated(
|
display.deprecated(
|
||||||
msg='ansible.utils.py3compat.environ is deprecated in favor of os.environ.',
|
msg='`ansible.utils.py3compat.environ` is deprecated.',
|
||||||
version='2.20',
|
version='2.20',
|
||||||
|
help_text='Use `os.environ` from the Python standard library instead.',
|
||||||
)
|
)
|
||||||
|
|
||||||
return os.environ
|
return os.environ
|
||||||
|
|||||||
@@ -57,8 +57,9 @@ def set_default_transport():
|
|||||||
# deal with 'smart' connection .. one time ..
|
# deal with 'smart' connection .. one time ..
|
||||||
if C.DEFAULT_TRANSPORT == 'smart':
|
if C.DEFAULT_TRANSPORT == 'smart':
|
||||||
display.deprecated(
|
display.deprecated(
|
||||||
msg="The 'smart' option for connections is deprecated. Set the connection plugin directly instead.",
|
msg="The `smart` option for connections is deprecated.",
|
||||||
version='2.20',
|
version="2.20",
|
||||||
|
help_text="Set the connection plugin directly instead.",
|
||||||
)
|
)
|
||||||
|
|
||||||
# see if SSH can support ControlPersist if not use paramiko
|
# see if SSH can support ControlPersist if not use paramiko
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ def get_plugin_vars(loader, plugin, path, entities):
|
|||||||
if hasattr(plugin, 'get_host_vars') or hasattr(plugin, 'get_group_vars'):
|
if hasattr(plugin, 'get_host_vars') or hasattr(plugin, 'get_group_vars'):
|
||||||
display.deprecated(
|
display.deprecated(
|
||||||
msg=f"The vars plugin {plugin.ansible_name} from {plugin._original_path} is relying "
|
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'. "
|
"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.",
|
|
||||||
version="2.20",
|
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:
|
try:
|
||||||
for entity in entities:
|
for entity in entities:
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export ANSIBLE_VARS_ENABLED=require_enabled
|
|||||||
|
|
||||||
# Test deprecated features
|
# Test deprecated features
|
||||||
export ANSIBLE_VARS_PLUGINS=./deprecation_warning
|
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_DEPRECATION_WARNINGS=True ANSIBLE_NOCOLOR=True ANSIBLE_FORCE_COLOR=False \
|
||||||
ansible-inventory -i localhost, --list all "$@" 2> err.txt
|
ansible-inventory -i localhost, --list all "$@" 2> err.txt
|
||||||
ansible localhost -m debug -a "msg={{ lookup('file', 'err.txt') | regex_replace('\n', '') }}" | grep "$WARNING"
|
ansible localhost -m debug -a "msg={{ lookup('file', 'err.txt') | regex_replace('\n', '') }}" | grep "$WARNING"
|
||||||
|
|||||||
Reference in New Issue
Block a user