diff --git a/workers/securityworker.py b/workers/securityworker.py index 29fdd3dcf..5768ad264 100644 --- a/workers/securityworker.py +++ b/workers/securityworker.py @@ -33,7 +33,6 @@ def _get_image_to_export(version): images = (Image .select(candidates.c.docker_image_id, candidates.c.uuid, candidates.c.checksum) - .distinct() .from_(candidates) .order_by(db_random_func()) .tuples() @@ -55,14 +54,13 @@ def _get_image_to_export(version): images = (Image .select(candidates.c.docker_image_id, candidates.c.uuid, candidates.c.checksum, candidates.c.parent_docker_image_id, candidates.c.parent_storage_uuid) - .distinct() .from_(candidates) .order_by(db_random_func()) .tuples() .limit(BATCH_SIZE)) for image in images: - rimages.append({'docker_image_id': image[0], 'storage_uuid': image[1], 'storage_checksum': image[2], 'parent_docker_image_id': None, 'parent_storage_uuid': None}) + rimages.append({'docker_image_id': image[0], 'storage_uuid': image[1], 'storage_checksum': image[2], 'parent_docker_image_id': image[3], 'parent_storage_uuid': image[4]}) # Re-shuffle, otherwise the images without parents will always be on the top random.shuffle(rimages) @@ -166,7 +164,7 @@ class SecurityWorker(Worker): 'TarSum': img['storage_checksum'], 'Path': uri } - if img['parent_docker_image_id'] is not None: + if img['parent_docker_image_id'] is not None and img['parent_storage_uuid'] is not None: request['ParentID'] = img['parent_docker_image_id']+'.'+img['parent_storage_uuid'] # Post request