Add check for Errors while deleting objects

This commit is contained in:
Elizaveta Chichindaeva 2023-04-13 16:50:08 +03:00 committed by Andrey Berezin
parent 010757b0a9
commit 4272bff8c9

View file

@ -168,6 +168,9 @@ def delete_objects_s3(s3_client, bucket: str, object_keys: list):
response = s3_client.delete_objects(Bucket=bucket, Delete=_make_objs_dict(object_keys)) response = s3_client.delete_objects(Bucket=bucket, Delete=_make_objs_dict(object_keys))
log_command_execution("S3 Delete objects result", response) log_command_execution("S3 Delete objects result", response)
sleep(S3_SYNC_WAIT_TIME) sleep(S3_SYNC_WAIT_TIME)
assert (
"Errors" not in response
), f'The following objects have not been deleted: {[err_info["Key"] for err_info in response["Errors"]]}.\nError Message: {response["Errors"]["Message"]}'
return response return response
except ClientError as err: except ClientError as err: