From d8a81c488e022e262fa99f4684dbfa2dda5df91a Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Wed, 12 Mar 2014 10:31:01 -0500 Subject: [PATCH] Remove validate_certs parameter from fetch_url calls --- library/monitoring/airbrake_deployment | 2 +- library/net_infrastructure/netscaler | 2 +- library/network/get_url | 7 +++---- library/packaging/apt_key | 2 +- library/packaging/rpm_key | 2 +- library/source_control/github_hooks | 6 +++--- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/library/monitoring/airbrake_deployment b/library/monitoring/airbrake_deployment index 55d6017e4e..89d62deda5 100644 --- a/library/monitoring/airbrake_deployment +++ b/library/monitoring/airbrake_deployment @@ -115,7 +115,7 @@ def main(): # Send the data to airbrake data = urllib.urlencode(params) - response, info = fetch_url(module, url, data=data, validate_certs=module.params['validate_certs']) + response, info = fetch_url(module, url, data=data) if info['status'] == 200: module.exit_json(changed=True) else: diff --git a/library/net_infrastructure/netscaler b/library/net_infrastructure/netscaler index 4756d90abd..2a8881cf56 100644 --- a/library/net_infrastructure/netscaler +++ b/library/net_infrastructure/netscaler @@ -122,7 +122,7 @@ class netscaler(object): 'Content-Type' : 'application/x-www-form-urlencoded', } - response, info = fetch_url(self.module, request_url, data=data_json, validate_certs=self.module.params['validate_certs']) + response, info = fetch_url(self.module, request_url, data=data_json) return json.load(response.read()) diff --git a/library/network/get_url b/library/network/get_url index c249c44049..8f0ccb1686 100644 --- a/library/network/get_url +++ b/library/network/get_url @@ -124,14 +124,14 @@ def url_filename(url): return 'index.html' return fn -def url_get(module, url, dest, use_proxy, last_mod_time, force, validate_certs): +def url_get(module, url, dest, use_proxy, last_mod_time, force): """ Download data from the url and store in a temporary file. Return (tempfile, info about the request) """ - rsp, info = fetch_url(module, url, use_proxy=use_proxy, force=force, last_mod_time=last_mod_time, validate_certs=validate_certs) + rsp, info = fetch_url(module, url, use_proxy=use_proxy, force=force, last_mod_time=last_mod_time) if info['status'] == 304: module.exit_json(url=url, dest=dest, changed=False, msg=info.get('msg', '')) @@ -192,7 +192,6 @@ def main(): force = module.params['force'] sha256sum = module.params['sha256sum'] use_proxy = module.params['use_proxy'] - validate_certs = module.params['validate_certs'] dest_is_dir = os.path.isdir(dest) last_mod_time = None @@ -207,7 +206,7 @@ def main(): last_mod_time = datetime.datetime.utcfromtimestamp(mtime) # download to tmpsrc - tmpsrc, info = url_get(module, url, dest, use_proxy, last_mod_time, force, validate_certs) + tmpsrc, info = url_get(module, url, dest, use_proxy, last_mod_time, force) # Now the request has completed, we can finally generate the final # destination file name from the info dict. diff --git a/library/packaging/apt_key b/library/packaging/apt_key index ff05bb93d1..48442349ae 100644 --- a/library/packaging/apt_key +++ b/library/packaging/apt_key @@ -140,7 +140,7 @@ def download_key(module, url): if url is None: module.fail_json(msg="needed a URL but was not specified") try: - rsp, info = fetch_url(module, url, validate_certs=module.params['validate_certs']) + rsp, info = fetch_url(module, url) return rsp.read() except Exception: module.fail_json(msg="error getting key id from url", traceback=format_exc()) diff --git a/library/packaging/rpm_key b/library/packaging/rpm_key index 9d85f30ac8..8a695c786f 100644 --- a/library/packaging/rpm_key +++ b/library/packaging/rpm_key @@ -123,7 +123,7 @@ class RpmKey: def fetch_key(self, url, maxbytes=MAXBYTES): """Downloads a key from url, returns a valid path to a gpg key""" try: - rsp, info = fetch_url(self.module, url, validate_certs=self.module.params['validate_certs']) + rsp, info = fetch_url(self.module, url) key = rsp.read(maxbytes) if not is_pubkey(key): self.module.fail_json(msg="Not a public key: %s" % url) diff --git a/library/source_control/github_hooks b/library/source_control/github_hooks index c5c5b648c7..6a8d1ced93 100644 --- a/library/source_control/github_hooks +++ b/library/source_control/github_hooks @@ -75,7 +75,7 @@ def list(module, hookurl, oauthkey, repo, user): headers = { 'Authorization': 'Basic %s' % auth, } - response, info = fetch_url(module, url, headers=headers, validate_certs=module.params['validate_certs']) + response, info = fetch_url(module, url, headers=headers) if info['status'] != 200: return False, '' else: @@ -120,7 +120,7 @@ def create(module, hookurl, oauthkey, repo, user): headers = { 'Authorization': 'Basic %s' % auth, } - response, info = fetch_url(module, url, data=data, headers=headers, validate_certs=module.params['validate_certs']) + response, info = fetch_url(module, url, data=data, headers=headers) if info['status'] != 200: return 0, '[]' else: @@ -132,7 +132,7 @@ def delete(module, hookurl, oauthkey, repo, user, hookid): headers = { 'Authorization': 'Basic %s' % auth, } - response, info = fetch_url(module, url, data=data, headers=headers, method='DELETE', validate_certs=module.params['validate_certs']) + response, info = fetch_url(module, url, data=data, headers=headers, method='DELETE') return response.read() def main():