From a2a8ba0217d87f9add064bf31c09ffc0b5049ebd Mon Sep 17 00:00:00 2001 From: ttgump Date: Tue, 30 Jul 2013 14:31:28 -0400 Subject: [PATCH] modified update.py --- tuf/client/updater.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tuf/client/updater.py b/tuf/client/updater.py index dca94cff..34a686fe 100755 --- a/tuf/client/updater.py +++ b/tuf/client/updater.py @@ -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').