Do not overwrite the kept_manifests variable when pruning

Previously, the kept_manifests variable was overwritten every time
self._prune() was called, instead of extending the list. Also, if
there were no objects in the registry, it could be used uninitialized.

Change-Id: I48573b8a0ed39ef072a9dc38aca60894f6d23623
This commit is contained in:
Javier Pena 2019-11-07 20:06:05 +01:00 committed by daniel.pawlik
parent 8da8973d6e
commit 726d73c47c

View File

@ -339,8 +339,9 @@ class Storage:
if not manifest_target:
continue
repopath = os.path.join(namespace.path, 'repos/')
kept_manifests = []
for repo in self.backend.list_objects(repopath):
kept_manifests = self._prune(repo, manifest_target)
kept_manifests.extend(self._prune(repo, manifest_target))
# mark/sweep manifest blobs
layers = set()
for manifest in kept_manifests: