Skip to content

Commit 0f5db48

Browse files
committed
Ruby 9k fix: keep the test file open until after uploading to S3
Fixes #149 Fixes #150
1 parent 2b13a82 commit 0f5db48

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
Gemfile.lock
33
.bundle
44
vendor
5+
.rakeTasks
6+
*.iml

lib/logstash/outputs/s3/write_bucket_permission_validator.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ def valid?(bucket_resource)
2020
rescue StandardError => e
2121
logger.error("Error validating bucket write permissions!",
2222
:message => e.message,
23-
:class => e.class.name
23+
:class => e.class.name,
24+
:backtrace => e.backtrace
2425
)
2526
false
2627
end
@@ -37,7 +38,6 @@ def upload_test_file(bucket_resource)
3738
f = Stud::Temporary.file
3839
f.write(content)
3940
f.fsync
40-
f.close
4141

4242
obj = bucket_resource.object(key)
4343
obj.upload_file(f)
@@ -50,6 +50,7 @@ def upload_test_file(bucket_resource)
5050
# since we only really need `putobject`.
5151
end
5252
ensure
53+
f.close
5354
FileUtils.rm_rf(f.path)
5455
end
5556
end

0 commit comments

Comments
 (0)