summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Martz <matt@sivel.net>2016-11-05 22:00:06 -0500
committerjctanner <tanner.jc@gmail.com>2016-11-05 23:00:06 -0400
commit931a7133503832702f614cb3427226ef35418301 (patch)
tree14df14c917c2819a11597056b3788b1dfe624431
parent872594b49a69a1f3795e0de3f7cf0194b6bdfd53 (diff)
downloadansible-modules-core-931a7133503832702f614cb3427226ef35418301.tar.gz
If fetch_url failed to download the URL fail early with a proper error message. Fixes #5474 (#5476)
-rw-r--r--packaging/os/yum.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/packaging/os/yum.py b/packaging/os/yum.py
index 131144d8..be5e1676 100644
--- a/packaging/os/yum.py
+++ b/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: