If fetch_url failed to download the URL fail early with a proper error message. Fixes #5474 (#5476)

This commit is contained in:
Matt Martz 2016-11-05 22:00:06 -05:00 committed by Matt Clay
parent 352d280058
commit 08ce50c2b3

View file

@ -225,6 +225,8 @@ def fetch_rpm_from_url(spec, module=None):
package = os.path.join(tempdir, str(spec.rsplit('/', 1)[1]))
try:
rsp, info = fetch_url(module, spec)
if not rsp:
module.fail_json(msg="Failure downloading %s, %s" % (spec, info['msg']))
f = open(package, 'w')
data = rsp.read(BUFSIZE)
while data: