From 04e6c5144530a0e2c445e2be9c29c14d5cb75052 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Thu, 9 May 2024 09:35:56 -0700 Subject: [PATCH] [stable-2.15] uri: update docs for follow_redirects (#83178) * [stable-2.15] uri: update docs for follow_redirects * Updated the docs for the parameter follow_redirects Signed-off-by: Abhijeet Kasurde (cherry picked from commit fcc6d0bd0c10421a803bddd66529e1c724bf8b04) * CI fixes Signed-off-by: Abhijeet Kasurde --------- Signed-off-by: Abhijeet Kasurde --- changelogs/fragments/uri_follow_redirect_bool.yml | 3 +++ lib/ansible/modules/uri.py | 15 ++++++++------- lib/ansible/plugins/lookup/url.py | 10 +++++++++- 3 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 changelogs/fragments/uri_follow_redirect_bool.yml diff --git a/changelogs/fragments/uri_follow_redirect_bool.yml b/changelogs/fragments/uri_follow_redirect_bool.yml new file mode 100644 index 00000000000..641485ed6ba --- /dev/null +++ b/changelogs/fragments/uri_follow_redirect_bool.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - uri - update the documentation for follow_redirects. diff --git a/lib/ansible/modules/uri.py b/lib/ansible/modules/uri.py index 77d81dd2f50..70c456e3730 100644 --- a/lib/ansible/modules/uri.py +++ b/lib/ansible/modules/uri.py @@ -108,14 +108,15 @@ options: default: no follow_redirects: description: - - Whether or not the URI module should follow redirects. C(all) will follow all redirects. - C(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. C(none) will not follow - any redirects. Note that C(true) and C(false) choices are accepted for backwards compatibility, - where C(true) is the equivalent of C(all) and C(false) is the equivalent of C(safe). C(true) and C(false) - are deprecated and will be removed in some future version of Ansible. + - Whether or not the URI module should follow redirects. + - V(all) Will follow all redirects. + - V(none) Will not follow any redirects. + - V(safe) Only redirects doing GET or HEAD requests will be followed. + - V(urllib2) Defer to urllib2 behavior (As of writing this follows HTTP redirects). + - V('no') (DEPRECATED, will be removed in the future version) alias of V(none). + - V('yes') (DEPRECATED, will be removed in the future version) alias of V(all). + choices: ['all', 'none', 'safe', 'urllib2', 'yes', 'no'] type: str - choices: ['all', 'no', 'none', 'safe', 'urllib2', 'yes'] default: safe creates: description: diff --git a/lib/ansible/plugins/lookup/url.py b/lib/ansible/plugins/lookup/url.py index 6790e1cedbe..1d0c294ae5b 100644 --- a/lib/ansible/plugins/lookup/url.py +++ b/lib/ansible/plugins/lookup/url.py @@ -88,7 +88,14 @@ options: - section: url_lookup key: agent follow_redirects: - description: String of urllib2, all/yes, safe, none to determine how redirects are followed, see RedirectHandlerFactory for more information + description: + - String of urllib2, all/yes, safe, none to determine how redirects are followed, see RedirectHandlerFactory for more information. + - V(all) Will follow all redirects. + - V(none) Will not follow any redirects. + - V(safe) Only redirects doing GET or HEAD requests will be followed. + - V(urllib2) Defer to urllib2 behavior (As of writing this follows HTTP redirects). + - V('no') (DEPRECATED, will be removed in the future version) alias of V(none). + - V('yes') (DEPRECATED, will be removed in the future version) alias of V(all). type: string version_added: "2.10" default: 'urllib2' @@ -99,6 +106,7 @@ options: ini: - section: url_lookup key: follow_redirects + choices: ['all', 'none', 'safe', 'urllib2', 'yes', 'no'] use_gssapi: description: - Use GSSAPI handler of requests