diff options
author | h4rr21 <juankchess13@hotmail.com> | 2022-04-06 13:21:49 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-06 13:21:49 -0400 |
commit | 1d9c68d27e10b6023d294d48e873ba4cdde46bbb (patch) | |
tree | bd3475b9f122c1f08ed0ccb200330adebffa92cf /lib/ansible | |
parent | 5b44035983aba190791df479fa7004ce20872042 (diff) | |
download | ansible-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')
-rw-r--r-- | lib/ansible/module_utils/urls.py | 7 | ||||
-rw-r--r-- | lib/ansible/modules/uri.py | 1 |
2 files changed, 6 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') diff --git a/lib/ansible/modules/uri.py b/lib/ansible/modules/uri.py index 1413d365de..5a91cd1f51 100644 --- a/lib/ansible/modules/uri.py +++ b/lib/ansible/modules/uri.py @@ -592,6 +592,7 @@ def uri(module, url, dest, body, body_format, method, headers, socket_timeout, c 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, + use_proxy=module.params['use_proxy'], **kwargs) if src: |