summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJill R <4121322+jillr@users.noreply.github.com>2019-08-28 06:27:08 -0700
committerAdam Miller <admiller@redhat.com>2019-08-28 08:27:08 -0500
commit8d167bdaef8469e0998996317023d3906a293485 (patch)
tree7a038fff93a440efc52791719f5073515472337b
parent73767778e01b3d682878e60d3ddbd1bf77bea229 (diff)
downloadansible-8d167bdaef8469e0998996317023d3906a293485.tar.gz
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
-rw-r--r--lib/ansible/module_utils/basic.py12
-rw-r--r--lib/ansible/module_utils/urls.py2
-rw-r--r--lib/ansible/modules/files/copy.py4
-rw-r--r--lib/ansible/modules/files/iso_extract.py4
-rw-r--r--lib/ansible/modules/net_tools/basics/get_url.py4
-rw-r--r--lib/ansible/modules/net_tools/basics/uri.py4
-rw-r--r--lib/ansible/plugins/doc_fragments/url.py1
7 files changed, 30 insertions, 1 deletions
diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py
index 31f32755c6..0cc1d52165 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 8574792aa6..4e5e959591 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 788fec9f99..6912439af6 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 ad65a66e9d..f6d24b309d 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 cd64818996..f7696cd73b 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 7cf1e63341..48e94cbff6 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 efbf39bd16..d6fdcc384d 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 ]