mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 19:31:26 -07:00
Adding validate_certs to all modules that use fetch_url
This commit is contained in:
parent
cfabc2e28a
commit
a9017af2bb
11 changed files with 99 additions and 5 deletions
|
@ -155,7 +155,7 @@ def url_argument_spec():
|
|||
|
||||
|
||||
def fetch_url(module, url, data=None, headers=None, method=None,
|
||||
use_proxy=False, validate_certs=True, force=False, last_mod_time=None, timeout=10):
|
||||
use_proxy=False, force=False, last_mod_time=None, timeout=10):
|
||||
'''
|
||||
Fetches a file from an HTTP/FTP server using urllib2
|
||||
'''
|
||||
|
@ -171,6 +171,9 @@ def fetch_url(module, url, data=None, headers=None, method=None,
|
|||
handlers = []
|
||||
info = dict(url=url)
|
||||
|
||||
# Get validate_certs from the module params
|
||||
validate_certs = module.params.get('validate_certs', True)
|
||||
|
||||
parsed = urlparse.urlparse(url)
|
||||
if parsed[0] == 'https':
|
||||
if not HAS_SSL and validate_certs:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue