Skip to content

Commit e7ce873

Browse files
author
Jussi Kukkonen
committed
updater: Add missing Exception documentation
Added ExpiredMetadataError to function documentation where it seems to be missing. Corrected the refresh() documentation: ExpiredMetadataError can only happen when top level metadata does not need to be updated but is expired. If the metadata gets updated and is expired, the result will be a NoWorkingMirror with ExpiredMetadata inside it. Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
1 parent 9908f8e commit e7ce873

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

tuf/client/updater.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,9 +1021,8 @@ def refresh(self, unsafely_update_root_if_necessary=True):
10211021
If the metadata for any of the top-level roles cannot be updated.
10221022
10231023
tuf.exceptions.ExpiredMetadataError:
1024-
If any of the top-level metadata is expired (whether a new version was
1025-
downloaded expired or no new version was found and the existing
1026-
version is now expired).
1024+
If any of the top-level metadata is expired and no new version was
1025+
found.
10271026
10281027
<Side Effects>
10291028
Updates the metadata files of the top-level roles with the latest
@@ -1900,6 +1899,9 @@ def _update_metadata_if_changed(self, metadata_role,
19001899
is 'timestamp'. See refresh().
19011900
19021901
<Exceptions>
1902+
tuf.exceptions.ExpiredMetadataError:
1903+
If local metadata is expired and newer metadata is not available.
1904+
19031905
tuf.exceptions.NoWorkingMirrorError:
19041906
If 'metadata_role' could not be downloaded after determining that it
19051907
had changed.
@@ -2393,7 +2395,6 @@ def _ensure_not_expired(self, metadata_object, metadata_rolename):
23932395
expires_timestamp = tuf.formats.datetime_to_unix_timestamp(expires_datetime)
23942396

23952397
current_time = int(time.time())
2396-
23972398
if expires_timestamp < current_time:
23982399
message = 'Metadata '+repr(metadata_rolename)+' expired on ' + \
23992400
expires_datetime.ctime() + ' (UTC).'
@@ -2495,6 +2496,9 @@ def _refresh_targets_metadata(self, rolename='targets',
24952496
repository (via snapshot.json) should be refreshed.
24962497
24972498
<Exceptions>
2499+
tuf.exceptions.ExpiredMetadataError:
2500+
If local metadata is expired and newer metadata is not available.
2501+
24982502
tuf.exceptions.RepositoryError:
24992503
If the metadata file for the 'targets' role is missing from the
25002504
'snapshot' metadata.
@@ -2715,6 +2719,9 @@ def get_one_valid_targetinfo(self, target_filepath):
27152719
the 'targets' (or equivalent) directory on a given mirror.
27162720
27172721
<Exceptions>
2722+
tuf.exceptions.ExpiredMetadataError:
2723+
If local metadata is expired and newer metadata is not available.
2724+
27182725
securesystemslib.exceptions.FormatError:
27192726
If 'target_filepath' is improperly formatted.
27202727
@@ -2770,6 +2777,9 @@ def _preorder_depth_first_walk(self, target_filepath):
27702777
the 'targets' (or equivalent) directory on a given mirror.
27712778
27722779
<Exceptions>
2780+
tuf.exceptions.ExpiredMetadataError:
2781+
If local metadata is expired and newer metadata is not available.
2782+
27732783
securesystemslib.exceptions.FormatError:
27742784
If 'target_filepath' is improperly formatted.
27752785

0 commit comments

Comments
 (0)