Merge pull request #3197 from dagwieers/unarchive-download-error-fix

unarchive: Ensure that download failure is properly raised before read fails
This commit is contained in:
Toshio Kuratomi 2016-03-08 12:23:53 -08:00
commit 80543ee6f8

View file

@ -282,6 +282,9 @@ def main():
package = os.path.join(tempdir, str(src.rsplit('/', 1)[1])) package = os.path.join(tempdir, str(src.rsplit('/', 1)[1]))
try: try:
rsp, info = fetch_url(module, src) rsp, info = fetch_url(module, src)
# If download fails, raise a proper exception
if rsp is None:
raise Exception(info['msg'])
f = open(package, 'w') f = open(package, 'w')
# Read 1kb at a time to save on ram # Read 1kb at a time to save on ram
while True: while True: