From 561ad496b79b5ec5afab311be47e39ec2856f7ca Mon Sep 17 00:00:00 2001 From: dachshund Date: Fri, 6 Sep 2013 16:58:18 -0400 Subject: [PATCH] Rename UpdateError exception to NoWorkingMirrorError. --- tuf/__init__.py | 3 ++- tuf/client/updater.py | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/tuf/__init__.py b/tuf/__init__.py index 2869ba2d..05036833 100755 --- a/tuf/__init__.py +++ b/tuf/__init__.py @@ -232,7 +232,8 @@ class InvalidNameError(Error): -class UpdateError(Error): + +class NoWorkingMirrorError(Error): """An updater will throw this exception in case it could not download a metadata or target file. diff --git a/tuf/client/updater.py b/tuf/client/updater.py index b741d148..32e1866b 100755 --- a/tuf/client/updater.py +++ b/tuf/client/updater.py @@ -544,7 +544,7 @@ def refresh(self): None. - tuf.UpdateError: + tuf.NoWorkingMirrorError: If the metadata for any of the top-level roles cannot be updated. tuf.ExpiredMetadataError: @@ -570,7 +570,7 @@ def refresh(self): # Update the top-level metadata. The _update_metadata_if_changed() and # _update_metadata() calls below do NOT perform an update if there # is insufficient trusted signatures for the specified metadata. - # Raise 'tuf.UpdateError' if an update fails. + # Raise 'tuf.NoWorkingMirrorError' if an update fails. # Use default but sane information for timestamp metadata, and do not # require strict checks on its required length. @@ -653,7 +653,7 @@ def get_target_file(self, target_filepath, file_length, file_hashes): The expected hashes of the target file. - tuf.UpdateError: + tuf.NoWorkingMirrorError: The target could not be fetched. This is raised only when all known mirrors failed to provide a valid copy of the desired target file. @@ -766,7 +766,7 @@ def unsafely_get_metadata_file(self, metadata_role, metadata_filepath, The expected length of the metadata file. - tuf.UpdateError: + tuf.NoWorkingMirrorError: The metadata could not be fetched. This is raised only when all known mirrors failed to provide a valid copy of the desired metadata file. @@ -815,7 +815,7 @@ def safely_get_metadata_file(self, metadata_role, metadata_filepath, The name of the compression algorithm used to compress the metadata. - tuf.UpdateError: + tuf.NoWorkingMirrorError: The metadata could not be fetched. This is raised only when all known mirrors failed to provide a valid copy of the desired metadata file. @@ -876,7 +876,7 @@ def __get_file(self, filepath, verify_file, file_type, The name of the compression algorithm used to compress the file. - tuf.UpdateError: + tuf.NoWorkingMirrorError: The metadata could not be fetched. This is raised only when all known mirrors failed to provide a valid copy of the desired metadata file. @@ -921,7 +921,7 @@ def __get_file(self, filepath, verify_file, file_type, else: logger.exception('Failed to download {0}: {1}'.format(filepath, file_mirror_errors)) - raise tuf.UpdateError(file_mirror_errors) + raise tuf.NoWorkingMirrorError(file_mirror_errors) @@ -960,7 +960,7 @@ def _update_metadata(self, metadata_role, fileinfo, compression=None): are considered. Any other string is ignored. - tuf.UpdateError: + tuf.NoWorkingMirrorError: The metadata could not be updated. This is not specific to a single failure but rather indicates that all possible ways to update the metadata have been tried and failed. @@ -1101,7 +1101,7 @@ def _update_metadata_if_changed(self, metadata_role, referenced_metadata='releas is 'timestamp'. See refresh(). - tuf.UpdateError: + tuf.NoWorkingMirrorError: If 'metadata_role' could not be downloaded after determining that it had changed. @@ -1980,7 +1980,7 @@ def target(self, target_filepath): The target information for 'target_filepath', conformant to 'tuf.formats.TARGETFILE_SCHEMA'. - + """ # Does 'target_filepath' have the correct format? @@ -2036,7 +2036,7 @@ def _preorder_depth_first_walk(self, target_filepath): role_names = ['targets'] # Ensure the client has the most up-to-date version of 'targets.txt'. - # Raise 'tuf.UpdateError' if the changed metadata cannot be successfully + # Raise 'tuf.NoWorkingMirrorError' if the changed metadata cannot be successfully # downloaded and 'tuf.RepositoryError' if the referenced metadata is # missing. Target methods such as this one are called after the top-level # metadata have been refreshed (i.e., updater.refresh()). @@ -2413,7 +2413,7 @@ def download_target(self, target, destination_directory): tuf.FormatError: If 'target' is not properly formatted. - tuf.UpdateError: + tuf.NoWorkingMirrorError: If a target could not be downloaded from any of the mirrors.