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: