summaryrefslogtreecommitdiff
path: root/lib/ansible/module_utils/urls.py
diff options
context:
space:
mode:
authorh4rr21 <juankchess13@hotmail.com>2022-04-06 13:21:49 -0400
committerGitHub <noreply@github.com>2022-04-06 13:21:49 -0400
commit1d9c68d27e10b6023d294d48e873ba4cdde46bbb (patch)
treebd3475b9f122c1f08ed0ccb200330adebffa92cf /lib/ansible/module_utils/urls.py
parent5b44035983aba190791df479fa7004ce20872042 (diff)
downloadansible-1d9c68d27e10b6023d294d48e873ba4cdde46bbb.tar.gz
honor use_proxy parameter (#77312)
* honor use_proxy parameter * fix uri test with "use_proxy: no" * fix urls.py module Co-authored-by: Carlos <Juan.Carlos.Cardenas.Viera@ibm.com>
Diffstat (limited to 'lib/ansible/module_utils/urls.py')
-rw-r--r--lib/ansible/module_utils/urls.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/ansible/module_utils/urls.py b/lib/ansible/module_utils/urls.py
index f34c536890..7e7ba225a3 100644
--- a/lib/ansible/module_utils/urls.py
+++ b/lib/ansible/module_utils/urls.py
@@ -1727,7 +1727,7 @@ def url_argument_spec():
def fetch_url(module, url, data=None, headers=None, method=None,
- use_proxy=True, force=False, last_mod_time=None, timeout=10,
+ use_proxy=None, force=False, last_mod_time=None, timeout=10,
use_gssapi=False, unix_socket=None, ca_path=None, cookies=None, unredirected_headers=None):
"""Sends a request via HTTP(S) or FTP (needs the module as parameter)
@@ -1737,7 +1737,7 @@ def fetch_url(module, url, data=None, headers=None, method=None,
:kwarg data: The data to be sent (in case of POST/PUT).
:kwarg headers: A dict with the request headers.
:kwarg method: "POST", "PUT", etc.
- :kwarg boolean use_proxy: Default: True
+ :kwarg use_proxy: (optional) whether or not to use proxy (Default: True)
:kwarg boolean force: If True: Do not get a cached copy (Default: False)
:kwarg last_mod_time: Default: None
:kwarg int timeout: Default: 10
@@ -1776,6 +1776,9 @@ def fetch_url(module, url, data=None, headers=None, method=None,
# Get validate_certs from the module params
validate_certs = module.params.get('validate_certs', True)
+ if use_proxy is None:
+ use_proxy = module.params.get('use_proxy', True)
+
username = module.params.get('url_username', '')
password = module.params.get('url_password', '')
http_agent = module.params.get('http_agent', 'ansible-httpget')