From fe100ab80a8d04928f8112bb1f150c106ea9de5f Mon Sep 17 00:00:00 2001 From: dachshund Date: Fri, 13 Sep 2013 17:59:31 -0400 Subject: [PATCH 1/3] Remove executable bits on some non-executable files. --- tuf/tests/repository_setup.py | 0 tuf/tests/unittest_toolbox.py | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 tuf/tests/repository_setup.py mode change 100755 => 100644 tuf/tests/unittest_toolbox.py diff --git a/tuf/tests/repository_setup.py b/tuf/tests/repository_setup.py old mode 100755 new mode 100644 diff --git a/tuf/tests/unittest_toolbox.py b/tuf/tests/unittest_toolbox.py old mode 100755 new mode 100644 From 8187be5232f8bb65d1a9ff4c2a3676122d9cfc6d Mon Sep 17 00:00:00 2001 From: dachshund Date: Fri, 13 Sep 2013 23:47:37 -0400 Subject: [PATCH 2/3] Simplify exception text in console handler. --- tuf/__init__.py | 6 +++--- tuf/client/updater.py | 6 +++--- tuf/log.py | 7 +++++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/tuf/__init__.py b/tuf/__init__.py index 503e4fcf..13964980 100755 --- a/tuf/__init__.py +++ b/tuf/__init__.py @@ -134,9 +134,9 @@ def __init__(self, metadata_role, previous_version, current_version): def __str__(self): - return str(self.metadata_role)+' is older than the version currently'+\ - 'installed.\nDownloaded version: '+repr(self.previous_version)+'\n'+\ - 'Current version: '+repr(self.current_version) + return 'Downloaded '+str(self.metadata_role)+' is older ('+\ + str(self.previous_version)+') than the version currently '+\ + 'installed ('+repr(self.current_version)+').' diff --git a/tuf/client/updater.py b/tuf/client/updater.py index 1d924f8c..a10a10e7 100755 --- a/tuf/client/updater.py +++ b/tuf/client/updater.py @@ -1021,7 +1021,7 @@ def __get_file(self, filepath, verify_uncompressed_file, file_type, except Exception, exception: # Remember the error from this mirror, and "reset" the target file. - logger.exception('Download failed from '+file_mirror+'.') + logger.exception('Update failed from '+file_mirror+'.') file_mirror_errors[file_mirror] = exception file_object = None else: @@ -1030,8 +1030,8 @@ def __get_file(self, filepath, verify_uncompressed_file, file_type, if file_object: return file_object else: - logger.exception('Failed to download {0}: {1}'.format(filepath, - file_mirror_errors)) + logger.exception('Failed to update {0} from all mirrors: {1}'.format( + filepath, file_mirror_errors)) raise tuf.NoWorkingMirrorError(file_mirror_errors) diff --git a/tuf/log.py b/tuf/log.py index 7987ec94..347cca63 100755 --- a/tuf/log.py +++ b/tuf/log.py @@ -141,8 +141,11 @@ def filter(self, record): # most useful for the console handler, which we do not wish to deluge # with too much data. Assuming that this filter is not applied to the # file logging handler, the user may always consult the file log for the - # original exception traceback. - record.exc_text = str(record.exc_info) + # original exception traceback. The exc_info is explained here: + # http://docs.python.org/2/library/sys.html#sys.exc_info + exc_type, exc_value, exc_traceback = record.exc_info + # Simply set the class name as the exception text. + record.exc_text = exc_type.__name__ # Always return True to signal that any given record must be formatted. return True From e003db34c5548737da14e77dc7f131d0e3ae8ffe Mon Sep 17 00:00:00 2001 From: dachshund Date: Sat, 14 Sep 2013 00:07:26 -0400 Subject: [PATCH 3/3] Add a log message. --- tuf/client/updater.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tuf/client/updater.py b/tuf/client/updater.py index a10a10e7..fc1f9d3c 100755 --- a/tuf/client/updater.py +++ b/tuf/client/updater.py @@ -1744,6 +1744,7 @@ def _ensure_not_expired(self, metadata_role): # returned by time.time() (i.e., current time), before comparing. if tuf.formats.parse_time(expires) < time.time(): message = 'Metadata '+repr(rolepath)+' expired on '+repr(expires)+'.' + logger.error(message) raise tuf.ExpiredMetadataError(message)