Fix PostgresSQL compatibility and parent omittance securityworker
This commit is contained in:
parent
a99b8fcfe4
commit
1b41200e49
1 changed files with 2 additions and 4 deletions
|
@ -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
|
||||
|
|
Reference in a new issue