Make fetch fail on 404.
This commit is contained in:
parent
26495ddce9
commit
921a5b5bcc
@ -224,6 +224,7 @@ def fetch_from_url(self, url):
|
|||||||
# Run curl but grab the mime type from the http headers
|
# Run curl but grab the mime type from the http headers
|
||||||
headers = spack.curl('-#', # status bar
|
headers = spack.curl('-#', # status bar
|
||||||
'-O', # save file to disk
|
'-O', # save file to disk
|
||||||
|
'-f', # fail on >400 errors
|
||||||
'-D', '-', # print out HTML headers
|
'-D', '-', # print out HTML headers
|
||||||
'-L', url,
|
'-L', url,
|
||||||
return_output=True, fail_on_error=False)
|
return_output=True, fail_on_error=False)
|
||||||
@ -233,6 +234,10 @@ def fetch_from_url(self, url):
|
|||||||
if self.archive_file:
|
if self.archive_file:
|
||||||
os.remove(self.archive_file)
|
os.remove(self.archive_file)
|
||||||
|
|
||||||
|
if spack.curl.returncode == 22:
|
||||||
|
# This is a 404. Curl will print the error.
|
||||||
|
raise FailedDownloadError(url)
|
||||||
|
|
||||||
if spack.curl.returncode == 60:
|
if spack.curl.returncode == 60:
|
||||||
# This is a certificate error. Suggest spack -k
|
# This is a certificate error. Suggest spack -k
|
||||||
raise FailedDownloadError(
|
raise FailedDownloadError(
|
||||||
|
Loading…
Reference in New Issue
Block a user