Skip to content

Commit afc7e66

Browse files
committed
Delete test files on the remote bucket
We are reverting the changes we did in #85, if we dont delete the files the files can polute the bucket. So we will try to delete them and ignore if it fails. Because in reality we only need the permission to put an object for this plugin to correctly work. Fixes: #97 Fixes #96
1 parent e1b663d commit afc7e66

File tree

1 file changed

+9
-0
lines changed
  • lib/logstash/outputs

1 file changed

+9
-0
lines changed

lib/logstash/outputs/s3.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,15 @@ def test_s3_write
258258

259259
begin
260260
write_on_bucket(test_filename)
261+
262+
begin
263+
remote_filename = "#{@prefix}#{File.basename(test_filename)}"
264+
bucket = @s3.buckets[@bucket]
265+
bucket.objects[remote_filename].delete
266+
rescue StandardError => e
267+
# we actually only need `put_object`, but if we dont delete them
268+
# we can have a lot of tests files
269+
end
261270
ensure
262271
File.delete(test_filename)
263272
end

0 commit comments

Comments
 (0)