From 9aa11e47c5b8ff4168d77e09da0e733dc90e9727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Wed, 27 Jul 2016 11:14:24 +0200 Subject: [PATCH] refresh_links_for_backend: properly handle deleted projects. --- pillar/application/modules/file_storage.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pillar/application/modules/file_storage.py b/pillar/application/modules/file_storage.py index 10c1f196..efa522c1 100644 --- a/pillar/application/modules/file_storage.py +++ b/pillar/application/modules/file_storage.py @@ -480,9 +480,13 @@ def refresh_links_for_backend(backend_name, chunk_size, expiry_seconds): log.debug('Skipping file %s, it has no project.', file_id) continue - count = proj_coll.count({'_id': project_id}) + count = proj_coll.count({'_id': project_id, '$or': [ + {'_deleted': {'$exists': False}}, + {'_deleted': False}, + ]}) + if count == 0: - log.debug('Skipping file %s, project does not exist.', file_id) + log.debug('Skipping file %s, project %s does not exist.', file_id, project_id) continue if 'file_path' not in file_doc: