mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
New updater: Update comments
Mostly remove comments that provide little value after all the changes. Also remove a unused variable from a test. Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
This commit is contained in:
parent
2bbf5bc178
commit
d35fc27b0a
2 changed files with 4 additions and 19 deletions
|
|
@ -79,8 +79,6 @@ def setUp(self):
|
|||
# We are inheriting from custom class.
|
||||
unittest_toolbox.Modified_TestCase.setUp(self)
|
||||
|
||||
self.repository_name = 'test_repository1'
|
||||
|
||||
# Copy the original repository files provided in the test folder so that
|
||||
# any modifications made to repository files are restricted to the copies.
|
||||
# The 'repository_data' directory is expected to exist in 'tuf.tests/'.
|
||||
|
|
@ -130,7 +128,7 @@ def tearDown(self):
|
|||
self.server_process_handler.flush_log()
|
||||
|
||||
def test_refresh(self):
|
||||
|
||||
# All metadata is in local directory already
|
||||
self.repository_updater.refresh()
|
||||
|
||||
# Get targetinfo for 'file1.txt' listed in targets
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ def _load_timestamp(self) -> None:
|
|||
data = self._load_local_metadata("timestamp")
|
||||
self._bundle.update_timestamp(data)
|
||||
except (OSError, exceptions.RepositoryError) as e:
|
||||
# Local load can fail: it's not fatal
|
||||
# Local timestamp does not exist or is invalid
|
||||
logger.debug("Failed to load local timestamp %s", e)
|
||||
|
||||
# Load from remote (whether local load succeeded or not)
|
||||
|
|
@ -290,7 +290,7 @@ def _load_snapshot(self) -> None:
|
|||
self._bundle.update_snapshot(data)
|
||||
logger.debug("Local snapshot is valid: not downloading new one")
|
||||
except (OSError, exceptions.RepositoryError) as e:
|
||||
# Local load failed: we must update from remote
|
||||
# Local snapshot does not exist or is invalid: update from remote
|
||||
logger.debug("Failed to load local snapshot %s", e)
|
||||
|
||||
metainfo = self._bundle.timestamp.signed.meta["snapshot.json"]
|
||||
|
|
@ -310,7 +310,7 @@ def _load_targets(self, role: str, parent_role: str) -> None:
|
|||
self._bundle.update_delegated_targets(data, role, parent_role)
|
||||
logger.debug("Local %s is valid: not downloading new one", role)
|
||||
except (OSError, exceptions.RepositoryError) as e:
|
||||
# Local load failed: we must update from remote
|
||||
# Local 'role' does not exist or is invalid: update from remote
|
||||
logger.debug("Failed to load local %s: %s", role, e)
|
||||
|
||||
metainfo = self._bundle.snapshot.signed.meta[f"{role}.json"]
|
||||
|
|
@ -333,14 +333,6 @@ def _preorder_depth_first_walk(self, target_filepath) -> Dict:
|
|||
visited_role_names = set()
|
||||
number_of_delegations = MAX_DELEGATIONS
|
||||
|
||||
# Ensure the client has the most up-to-date version of 'targets.json'.
|
||||
# Raise 'exceptions.NoWorkingMirrorError' if the changed metadata
|
||||
# cannot be successfully downloaded and
|
||||
# 'exceptions.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()).
|
||||
# self._update_metadata_if_changed('targets')
|
||||
|
||||
# Preorder depth-first traversal of the graph of target delegations.
|
||||
while (
|
||||
target is None and number_of_delegations > 0 and len(role_names) > 0
|
||||
|
|
@ -357,11 +349,6 @@ def _preorder_depth_first_walk(self, target_filepath) -> Dict:
|
|||
|
||||
# The metadata for 'role_name' must be downloaded/updated before
|
||||
# its targets, delegations, and child roles can be inspected.
|
||||
# _refresh_targets_metadata() does not refresh 'targets.json', it
|
||||
# expects _update_metadata_if_changed() to have already refreshed
|
||||
# it, which this function has checked above.
|
||||
# self._refresh_targets_metadata(role_name,
|
||||
# refresh_all_delegated_roles=False)
|
||||
|
||||
role_metadata = self._bundle[role_name].signed
|
||||
target = role_metadata.targets.get(target_filepath)
|
||||
|
|
|
|||
Loading…
Reference in a new issue