mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
modified update.py
This commit is contained in:
parent
d245678148
commit
a2a8ba0217
1 changed files with 8 additions and 2 deletions
|
|
@ -1719,6 +1719,12 @@ def download_target(self, target, destination_directory):
|
|||
trusted_hashes = target['fileinfo']['hashes']
|
||||
|
||||
target_file_object = None
|
||||
|
||||
# Store mirrors which doesn't work well
|
||||
mirror_errors = {}
|
||||
|
||||
logger.info('Trying to download: '+repr(target_filepath))
|
||||
|
||||
# Iterate through the repositority mirrors until we successfully
|
||||
# download a target.
|
||||
for mirror_url in get_mirrors('target', target_filepath, self.mirrors):
|
||||
|
|
@ -1727,13 +1733,13 @@ def download_target(self, target, destination_directory):
|
|||
trusted_length)
|
||||
break
|
||||
except (tuf.DownloadError, tuf.FormatError), e:
|
||||
raise
|
||||
mirror_errors[mirror_url] = e
|
||||
logger.warn('Download failed from '+mirror_url+'.')
|
||||
target_file_object = None
|
||||
continue
|
||||
# We have gone through all the mirrors. Did we get a target file object?
|
||||
if target_file_object == None:
|
||||
raise tuf.DownloadError('No download locations known.')
|
||||
raise tuf.DownloadError('No download locations known: '+repr(mirror_errors))
|
||||
|
||||
# We acquired a target file object from a mirror. Move the file into
|
||||
# place (i.e., locally to 'destination_directory').
|
||||
|
|
|
|||
Loading…
Reference in a new issue