diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index 31f32755c63..0cc1d521653 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -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): diff --git a/lib/ansible/module_utils/urls.py b/lib/ansible/module_utils/urls.py index 8574792aa6c..4e5e959591c 100644 --- a/lib/ansible/module_utils/urls.py +++ b/lib/ansible/module_utils/urls.py @@ -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), diff --git a/lib/ansible/modules/files/copy.py b/lib/ansible/modules/files/copy.py index 788fec9f99c..6912439af6f 100644 --- a/lib/ansible/modules/files/copy.py +++ b/lib/ansible/modules/files/copy.py @@ -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'] diff --git a/lib/ansible/modules/files/iso_extract.py b/lib/ansible/modules/files/iso_extract.py index ad65a66e9d3..f6d24b309d7 100644 --- a/lib/ansible/modules/files/iso_extract.py +++ b/lib/ansible/modules/files/iso_extract.py @@ -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, diff --git a/lib/ansible/modules/net_tools/basics/get_url.py b/lib/ansible/modules/net_tools/basics/get_url.py index cd64818996e..f7696cd73bf 100644 --- a/lib/ansible/modules/net_tools/basics/get_url.py +++ b/lib/ansible/modules/net_tools/basics/get_url.py @@ -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'] diff --git a/lib/ansible/modules/net_tools/basics/uri.py b/lib/ansible/modules/net_tools/basics/uri.py index 7cf1e63341c..48e94cbff6f 100644 --- a/lib/ansible/modules/net_tools/basics/uri.py +++ b/lib/ansible/modules/net_tools/basics/uri.py @@ -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() diff --git a/lib/ansible/plugins/doc_fragments/url.py b/lib/ansible/plugins/doc_fragments/url.py index efbf39bd160..d6fdcc384d0 100644 --- a/lib/ansible/plugins/doc_fragments/url.py +++ b/lib/ansible/plugins/doc_fragments/url.py @@ -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 ]