Added --fail argument to curl invocations, so that HTTP request fails get surfaced as non-zero exit codes
This commit is contained in:
@@ -59,21 +59,21 @@ def download(img):
|
||||
for f in img['files']:
|
||||
if f['kind'] == 'kernel':
|
||||
dest = os.path.join(tempdir, 'kernel')
|
||||
subprocess.call(['curl', f['url'], '-o', dest])
|
||||
subprocess.call(['curl', '--fail', f['url'], '-o', dest])
|
||||
kernel_id = image.Image.add(dest,
|
||||
description='kernel/' + img['title'], kernel=True)
|
||||
|
||||
for f in img['files']:
|
||||
if f['kind'] == 'ramdisk':
|
||||
dest = os.path.join(tempdir, 'ramdisk')
|
||||
subprocess.call(['curl', f['url'], '-o', dest])
|
||||
subprocess.call(['curl', '--fail', f['url'], '-o', dest])
|
||||
ramdisk_id = image.Image.add(dest,
|
||||
description='ramdisk/' + img['title'], ramdisk=True)
|
||||
|
||||
for f in img['files']:
|
||||
if f['kind'] == 'image':
|
||||
dest = os.path.join(tempdir, 'image')
|
||||
subprocess.call(['curl', f['url'], '-o', dest])
|
||||
subprocess.call(['curl', '--fail', f['url'], '-o', dest])
|
||||
ramdisk_id = image.Image.add(dest,
|
||||
description=img['title'], kernel=kernel_id, ramdisk=ramdisk_id)
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ def fetchfile(url, target):
|
||||
# c.perform()
|
||||
# c.close()
|
||||
# fp.close()
|
||||
execute("curl %s -o %s" % (url, target))
|
||||
execute("curl --fail %s -o %s" % (url, target))
|
||||
|
||||
def execute(cmd, input=None, addl_env=None, check_exit_code=True):
|
||||
env = os.environ.copy()
|
||||
|
||||
Reference in New Issue
Block a user