Commit d44ed533 by James Cammarata

Default use_proxy to True for fetch_url()

Also added some error handling to the fetch_url() call in the
apt_repository module, so that failures to look up the PPA info
are properly handled.

Fixes #7322
parent 08406c0e
...@@ -291,7 +291,7 @@ def url_argument_spec(): ...@@ -291,7 +291,7 @@ def url_argument_spec():
def fetch_url(module, url, data=None, headers=None, method=None, def fetch_url(module, url, data=None, headers=None, method=None,
use_proxy=False, force=False, last_mod_time=None, timeout=10): use_proxy=True, force=False, last_mod_time=None, timeout=10):
''' '''
Fetches a file from an HTTP/FTP server using urllib2 Fetches a file from an HTTP/FTP server using urllib2
''' '''
......
...@@ -320,6 +320,8 @@ class UbuntuSourcesList(SourcesList): ...@@ -320,6 +320,8 @@ class UbuntuSourcesList(SourcesList):
headers = dict(Accept='application/json') headers = dict(Accept='application/json')
response, info = fetch_url(self.module, lp_api, headers=headers) response, info = fetch_url(self.module, lp_api, headers=headers)
if info['status'] != 200:
self.module.fail_json(msg="failed to fetch PPA information, error was: %s" % info['msg'])
return json.load(response) return json.load(response)
def _expand_ppa(self, path): def _expand_ppa(self, path):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment