pmb.helpers.http.download respects --offline flag (MR 1930)

fixes #1837
This commit is contained in:
Anjandev Momi 2020-04-26 21:07:14 -07:00 committed by Oliver Smith
parent 9c2d951fc9
commit 44ab2f8c40
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 4 additions and 0 deletions

View File

@ -38,6 +38,10 @@ def download(args, url, prefix, cache=True, loglevel=logging.INFO,
return path
pmb.helpers.run.user(args, ["rm", path])
# Offline and not cached
if args.offline:
raise RuntimeError(f"File not found in cache and offline flag is enabled: {url}")
# Download the file
logging.log(loglevel, "Download " + url)
try: