uri: deprecate 'yes' or 'no' value in follow_redirects param (#83169)

* uri (module and lookup): deprecate 'yes' or 'no' value in follow_redirects param

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/83188/head
Abhijeet Kasurde 1 month ago committed by GitHub
parent cd9c4eb5a6
commit 2b65166a29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,3 @@
---
bugfixes:
- uri - deprecate 'yes' and 'no' value for 'follow_redirects' parameter.

@ -107,15 +107,16 @@ options:
default: no
follow_redirects:
description:
- Whether or not the URI module should follow redirects. V(all) will follow all redirects.
V(safe) will follow only "safe" redirects, where "safe" means that the client is only
doing a GET or HEAD on the URI to which it is being redirected. V(none) will not follow
any redirects. Note that V(true) and V(false) choices are accepted for backwards compatibility,
where V(true) is the equivalent of V(all) and V(false) is the equivalent of V(safe). V(true) and V(false)
are deprecated and will be removed in some future version of Ansible.
- Whether or not the URI module should follow redirects.
type: str
choices: ['all', 'no', 'none', 'safe', 'urllib2', 'yes']
default: safe
choices:
all: Will follow all redirects.
none: Will not follow any redirects.
safe: Only redirects doing GET or HEAD requests will be followed.
urllib2: Defer to urllib2 behavior (As of writing this follows HTTP redirects).
'no': (DEPRECATED, removed in 2.22) alias of V(none).
'yes': (DEPRECATED, removed in 2.22) alias of V(all).
creates:
description:
- A filename, when it already exists, this step will not be run.
@ -580,6 +581,12 @@ def uri(module, url, dest, body, body_format, method, headers, socket_timeout, c
# if destination file already exist, only download if file newer
kwargs['last_mod_time'] = utcfromtimestamp(os.path.getmtime(dest))
if module.params.get('follow_redirects') in ('no', 'yes'):
module.deprecate(
"Using 'yes' or 'no' for 'follow_redirects' parameter is deprecated.",
version='2.22'
)
resp, info = fetch_url(module, url, data=data, headers=headers,
method=method, timeout=socket_timeout, unix_socket=module.params['unix_socket'],
ca_path=ca_path, unredirected_headers=unredirected_headers,

@ -99,12 +99,12 @@ options:
- section: url_lookup
key: follow_redirects
choices:
- urllib2
- all
- 'yes'
- safe
- none
- 'no'
all: Will follow all redirects.
none: Will not follow any redirects.
safe: Only redirects doing GET or HEAD requests will be followed.
urllib2: Defer to urllib2 behavior (As of writing this follows HTTP redirects).
'no': (DEPRECATED, removed in 2.22) alias of V(none).
'yes': (DEPRECATED, removed in 2.22) alias of V(all).
use_gssapi:
description:
- Use GSSAPI handler of requests
@ -234,6 +234,11 @@ class LookupModule(LookupBase):
ret = []
for term in terms:
display.vvvv("url lookup connecting to %s" % term)
if self.get_option('follow_redirects') in ('yes', 'no'):
display.deprecated(
"Using 'yes' or 'no' for 'follow_redirects' parameter is deprecated.",
version='2.22'
)
try:
response = open_url(
term, validate_certs=self.get_option('validate_certs'),

Loading…
Cancel
Save