Added --fail argument to curl invocations, so that HTTP request fails get surfaced as non-zero exit codes

This commit is contained in:
Justin Santa Barbara
2010-07-29 14:48:10 -07:00
parent 2acb1fed25
commit 62cb16f6e6
2 changed files with 4 additions and 4 deletions

View File

@@ -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)

View File

@@ -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()