mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
Merge pull request #1226 from jku/updater-close-file-object
Updater: close file object
This commit is contained in:
commit
fc4b77f92c
2 changed files with 5 additions and 3 deletions
|
|
@ -299,7 +299,7 @@ def flush_log(self):
|
|||
break
|
||||
|
||||
if len(self.__logged_messages) > 0:
|
||||
title = "Test server (" + self.server + ") output:"
|
||||
title = "Test server (" + self.server + ") output:\n"
|
||||
message = [title] + self.__logged_messages
|
||||
self.__logger.info('| '.join(message))
|
||||
self.__logged_messages = []
|
||||
|
|
|
|||
|
|
@ -1320,10 +1320,12 @@ def _get_target_file(self, target_filepath, file_length, file_hashes,
|
|||
return file_object
|
||||
|
||||
except Exception as exception:
|
||||
# Remember the error from this mirror, and "reset" the target file.
|
||||
# Remember the error from this mirror, close tempfile if one was opened
|
||||
logger.debug('Update failed from ' + file_mirror + '.')
|
||||
file_mirror_errors[file_mirror] = exception
|
||||
file_object = None
|
||||
if file_object is not None:
|
||||
file_object.close()
|
||||
file_object = None
|
||||
|
||||
logger.debug('Failed to update ' + repr(target_filepath) + ' from'
|
||||
' all mirrors: ' + repr(file_mirror_errors))
|
||||
|
|
|
|||
Loading…
Reference in a new issue