Skip to content

Commit

Permalink
log s3 batch deletes (#5204)
Browse files Browse the repository at this point in the history
* log s3 batch deletes
  • Loading branch information
lcouzens committed Jul 3, 2024
1 parent bdbbfee commit 67af027
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion koku/masu/test/util/aws/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def test_batch_delete_s3_objects(self, mock_resource):
mock_bucket.delete_objects.assert_has_calls(
[call(Delete={"Objects": expected_keys[:1000]}), call(Delete={"Objects": expected_keys[1000:]})]
)
self.assertIn("removed files from s3 bucket", captured_logs.output[-1])
self.assertIn("removed batch files from s3 bucket", captured_logs.output[-1])

def test_remove_s3_objects_not_matching_metadata(self):
"""Test remove_s3_objects_not_matching_metadata."""
Expand Down
16 changes: 8 additions & 8 deletions koku/masu/util/aws/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -803,15 +803,15 @@ def delete_s3_objects(request_id, keys_to_delete, context) -> list[str]:
batch_end = batch_start + batch_size
object_keys_batch = keys_to_delete[batch_start:batch_end]
s3_bucket.delete_objects(Delete={"Objects": object_keys_batch})
LOG.info(
log_json(
request_id,
msg="removed files from s3 bucket",
context=context,
bucket=settings.S3_BUCKET_NAME,
file_list=keys_to_delete,
LOG.info(
log_json(
request_id,
msg="removed batch files from s3 bucket",
context=context,
bucket=settings.S3_BUCKET_NAME,
file_list=object_keys_batch,
)
)
)
return keys_to_delete
except (EndpointConnectionError, ClientError) as err:
LOG.warning(
Expand Down

0 comments on commit 67af027

Please sign in to comment.