Deprecate alias 'thirsty' from all usages (#61245)

* Deprecate alias 'thirsty' from all usages

Fixes: #61236

* Now with added version quoting

* Handle deprecated aliases in mod_utils

* Make alias deprecation a subkey of the canonical arg, and not a separate argument
pull/60960/head
Jill R 5 years ago committed by Adam Miller
parent 73767778e0
commit 8d167bdaef

@ -1427,6 +1427,18 @@ class AnsibleModule(object):
alias_results, self._legal_inputs = handle_aliases(spec, param, alias_warnings=alias_warnings)
for option, alias in alias_warnings:
self._warnings.append('Both option %s and its alias %s are set.' % (option_prefix + option, option_prefix + alias))
deprecated_aliases = []
for i in spec.keys():
if 'deprecated_aliases' in spec[i].keys():
for alias in spec[i]['deprecated_aliases']:
deprecated_aliases.append(alias)
for deprecation in deprecated_aliases:
if deprecation['name'] in param.keys():
self._deprecations.append(
{'msg': "Alias '%s' is deprecated. See the module docs for more information" % deprecation['name'],
'version': deprecation['version']})
return alias_results
def _handle_no_log_values(self, spec=None, param=None):

@ -1409,7 +1409,7 @@ def url_argument_spec():
'''
return dict(
url=dict(type='str'),
force=dict(type='bool', default=False, aliases=['thirsty']),
force=dict(type='bool', default=False, aliases=['thirsty'], deprecated_aliases=[dict(name='thirsty', version='2.13')]),
http_agent=dict(type='str', default='ansible-httpget'),
use_proxy=dict(type='bool', default=True),
validate_certs=dict(type='bool', default=True),

@ -60,6 +60,7 @@ options:
- Influence whether the remote file must always be replaced.
- If C(yes), the remote file will be replaced when contents are different than the source.
- If C(no), the file will only be transferred if the destination does not exist.
- Alias C(thirsty) has been deprecated and will be removed in 2.13.
type: bool
default: yes
aliases: [ thirsty ]
@ -510,6 +511,9 @@ def main():
supports_check_mode=True,
)
if module.params.get('thirsty'):
module.deprecate('The alias "thirsty" has been deprecated and will be removed, use "force" instead', version='2.13')
src = module.params['src']
b_src = to_bytes(src, errors='surrogate_or_strict')
dest = module.params['dest']

@ -56,6 +56,7 @@ options:
description:
- If C(yes), which will replace the remote file when contents are different than the source.
- If C(no), the file will only be extracted and copied if the destination does not already exist.
- Alias C(thirsty) has been deprecated and will be removed in 2.13.
type: bool
default: yes
aliases: [ thirsty ]
@ -117,6 +118,9 @@ def main():
force = module.params['force']
executable = module.params['executable']
if module.params.get('thirsty'):
module.deprecate('The alias "thirsty" has been deprecated and will be removed, use "force" instead', version='2.13')
result = dict(
changed=False,
dest=dest,

@ -61,6 +61,7 @@ options:
will only be downloaded if the destination does not exist. Generally
should be C(yes) only for small local files.
- Prior to 0.6, this module behaved as if C(yes) was the default.
- Alias C(thirsty) has been deprecated and will be removed in 2.13.
type: bool
default: no
aliases: [ thirsty ]
@ -446,6 +447,9 @@ def main():
mutually_exclusive=[['checksum', 'sha256sum']],
)
if module.params.get('thirsty'):
module.deprecate('The alias "thirsty" has been deprecated and will be removed, use "force" instead', version='2.13')
url = module.params['url']
dest = module.params['dest']
backup = module.params['backup']

@ -154,6 +154,7 @@ options:
force:
description:
- If C(yes) do not get a cached copy.
- Alias C(thirsty) has been deprecated and will be removed in 2.13.
type: bool
default: no
aliases: [ thirsty ]
@ -574,6 +575,9 @@ def main():
mutually_exclusive=[['body', 'src']],
)
if module.params.get('thirsty'):
module.deprecate('The alias "thirsty" has been deprecated and will be removed, use "force" instead', version='2.13')
url = module.params['url']
body = module.params['body']
body_format = module.params['body_format'].lower()

@ -16,6 +16,7 @@ options:
force:
description:
- If C(yes) do not get a cached copy.
- Alias C(thirsty) has been deprecated and will be removed in 2.13.
type: bool
default: no
aliases: [ thirsty ]

Loading…
Cancel
Save