From 08ce50c2b3eea4a1841dd5b53e131f9866b400b7 Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Sat, 5 Nov 2016 22:00:06 -0500 Subject: [PATCH] If fetch_url failed to download the URL fail early with a proper error message. Fixes #5474 (#5476) --- lib/ansible/modules/packaging/os/yum.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ansible/modules/packaging/os/yum.py b/lib/ansible/modules/packaging/os/yum.py index dfa58a67219..449f37913c3 100644 --- a/lib/ansible/modules/packaging/os/yum.py +++ b/lib/ansible/modules/packaging/os/yum.py @@ -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: