Skip to content

Commit

Permalink
Repo simulator: make delegates() to all_targets()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
MVrachev committed Oct 12, 2021
1 parent ae2b246 commit 578aba0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/repository_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -264,8 +265,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:
Expand Down

0 comments on commit 578aba0

Please sign in to comment.