mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
Repo simulator: make delegates() to all_targets()
Modify RepositorySimulator function delegates() to all_targets(), so that all targets can be traversed and updated with one cycle when calling update_snapshot() (which is the only use case for now for delegates()). Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
This commit is contained in:
parent
f1f76d259f
commit
717eef9bb5
1 changed files with 3 additions and 3 deletions
|
|
@ -124,7 +124,8 @@ def snapshot(self) -> Snapshot:
|
|||
def targets(self) -> Targets:
|
||||
return self.md_targets.signed
|
||||
|
||||
def delegates(self) -> Iterator[Tuple[str, Targets]]:
|
||||
def all_targets(self) -> Iterator[Tuple[str, Targets]]:
|
||||
yield "targets", self.md_targets.signed
|
||||
for role, md in self.md_delegates.items():
|
||||
yield role, md.signed
|
||||
|
||||
|
|
@ -266,8 +267,7 @@ def update_timestamp(self):
|
|||
self.timestamp.version += 1
|
||||
|
||||
def update_snapshot(self):
|
||||
self.snapshot.meta["targets.json"].version = self.targets.version
|
||||
for role, delegate in self.delegates():
|
||||
for role, delegate in self.all_targets():
|
||||
self.snapshot.meta[f"{role}.json"].version = delegate.version
|
||||
|
||||
if self.compute_metafile_hashes_length:
|
||||
|
|
|
|||
Loading…
Reference in a new issue