Add check for Error while deleting objects #32
1 changed files with 3 additions and 0 deletions
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue