Fix spelling of ancestors

This commit is contained in:
Joseph Schorr 2015-07-28 14:45:03 -04:00
parent ba7686af99
commit 0fdc8b0f1f

View file

@ -119,17 +119,17 @@ def garbage_collect_repo(repo):
.join(RepositoryTag)
.where(Image.repository == repo))
referenced_anscestors = set()
referenced_ancestors = set()
for tagged_image in tagged_images:
# The anscestor list is in the format '/1/2/3/', extract just the ids
anscestor_id_strings = tagged_image.ancestors.split('/')[1:-1]
ancestor_list = [int(img_id_str) for img_id_str in anscestor_id_strings]
referenced_anscestors = referenced_anscestors.union(set(ancestor_list))
referenced_anscestors.add(tagged_image.id)
# The ancestor list is in the format '/1/2/3/', extract just the ids
ancestor_id_strings = tagged_image.ancestors.split('/')[1:-1]
ancestor_list = [int(img_id_str) for img_id_str in ancestor_id_strings]
referenced_ancestors = referenced_ancestors.union(set(ancestor_list))
referenced_ancestors.add(tagged_image.id)
all_repo_images = Image.select(Image.id, Image.storage).where(Image.repository == repo)
all_images = {int(img.id): img for img in all_repo_images}
to_remove = set(all_images.keys()).difference(referenced_anscestors)
to_remove = set(all_images.keys()).difference(referenced_ancestors)
if len(to_remove) > 0:
logger.info('Cleaning up unreferenced images: %s', to_remove)