logstash-output-s3 4.0.11 → 4.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a315ceb77a4088e461235d7dc3b1817119fc4e5
4
- data.tar.gz: 8c8af8b37bc0fc28e04047bcc28e4e3cb2eeceab
3
+ metadata.gz: 60f9298913378fe2ddc323e47608446b5c5a86d7
4
+ data.tar.gz: af5202e4af32c0c4fa7dddbfec8c2555d7ef11d5
5
5
  SHA512:
6
- metadata.gz: 9f8ce1595416a8073ed3787ab7a157a06e72a5abca3dd73c27d188d6038a114281163abb95fd77ef9d12539e7521e11f680cb9c1d6632b0007800daa1ea52dda
7
- data.tar.gz: f103fdbc0246870d301f59e306f182dd459123ee62d78324f6d51511917c97c89751f7ff50976d8e86cc2454d5028a2e373b4ff978760987f7e03874bde1887d
6
+ metadata.gz: 7944e4f6b681ab943d91a721e9c64dad4d811e9bd2dd7c1cb5169df842361750a95221f2fcb6db895356d0c1a87d8ca96e39f7895a482b65684151da47b1a284
7
+ data.tar.gz: ee024969ccf2968b408a1fc9e6a78714d02d9a900f47ae6e72b2d3dc81c40e44274798e81fadfa720fa88166b53f0eb6d2dc327a72bcd6ed6a19bc58169dfa2d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 4.0.12
2
+ - Fix bug where output would fail if the s3 bucket had encryption enabled (#146, #155)
3
+
1
4
  ## 4.0.11
2
5
  - Fixed a randomly occurring error that logged as a missing `__jcreate_meta` method
3
6
 
@@ -197,7 +197,7 @@ class LogStash::Outputs::S3 < LogStash::Outputs::Base
197
197
  raise LogStash::ConfigurationError, "Logstash must have the permissions to write to the temporary directory: #{@temporary_directory}"
198
198
  end
199
199
 
200
- if @validate_credentials_on_root_bucket && !WriteBucketPermissionValidator.new(@logger).valid?(bucket_resource)
200
+ if @validate_credentials_on_root_bucket && !WriteBucketPermissionValidator.new(@logger).valid?(bucket_resource, upload_options)
201
201
  raise LogStash::ConfigurationError, "Logstash must have the privileges to write to root bucket `#{@bucket}`, check your credentials or your permissions."
202
202
  end
203
203
 
@@ -13,7 +13,7 @@ module LogStash
13
13
  @logger = logger
14
14
  end
15
15
 
16
- def valid?(bucket_resource)
16
+ def valid?(bucket_resource, upload_options = {})
17
17
  begin
18
18
  upload_test_file(bucket_resource)
19
19
  true
@@ -28,7 +28,7 @@ module LogStash
28
28
  end
29
29
 
30
30
  private
31
- def upload_test_file(bucket_resource)
31
+ def upload_test_file(bucket_resource, upload_options = {})
32
32
  generated_at = Time.now
33
33
 
34
34
  key = "logstash-programmatic-access-test-object-#{generated_at}"
@@ -40,7 +40,7 @@ module LogStash
40
40
  f.fsync
41
41
 
42
42
  obj = bucket_resource.object(key)
43
- obj.upload_file(f)
43
+ obj.upload_file(f, upload_options)
44
44
 
45
45
  begin
46
46
  obj.delete
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-s3'
3
- s.version = '4.0.11'
3
+ s.version = '4.0.12'
4
4
  s.licenses = ['Apache-2.0']
5
5
  s.summary = "This plugin was created for store the logstash's events into Amazon Simple Storage Service (Amazon S3)"
6
6
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
@@ -9,6 +9,7 @@ describe LogStash::Outputs::S3::WriteBucketPermissionValidator do
9
9
  let(:obj) { double("s3_object") }
10
10
  let(:client) { Aws::S3::Client.new(stub_responses: true) }
11
11
  let(:bucket) { Aws::S3::Bucket.new(bucket_name, :client => client) }
12
+ let(:upload_options) { {} }
12
13
 
13
14
  subject { described_class.new(logger) }
14
15
 
@@ -20,20 +21,20 @@ describe LogStash::Outputs::S3::WriteBucketPermissionValidator do
20
21
  it "returns true" do
21
22
  expect(obj).to receive(:upload_file).with(any_args).and_return(true)
22
23
  expect(obj).to receive(:delete).and_return(true)
23
- expect(subject.valid?(bucket)).to be_truthy
24
+ expect(subject.valid?(bucket, upload_options)).to be_truthy
24
25
  end
25
26
 
26
27
  it "hides delete errors" do
27
28
  expect(obj).to receive(:upload_file).with(any_args).and_return(true)
28
29
  expect(obj).to receive(:delete).and_raise(StandardError)
29
- expect(subject.valid?(bucket)).to be_truthy
30
+ expect(subject.valid?(bucket, upload_options)).to be_truthy
30
31
  end
31
32
  end
32
33
 
33
34
  context "when permission aren't sufficient" do
34
35
  it "returns false" do
35
36
  expect(obj).to receive(:upload_file).with(any_args).and_raise(StandardError)
36
- expect(subject.valid?(bucket)).to be_falsey
37
+ expect(subject.valid?(bucket, upload_options)).to be_falsey
37
38
  end
38
39
  end
39
40
  end
@@ -25,7 +25,7 @@ describe LogStash::Outputs::S3 do
25
25
 
26
26
  before do
27
27
  allow(subject).to receive(:bucket_resource).and_return(mock_bucket)
28
- allow_any_instance_of(LogStash::Outputs::S3::WriteBucketPermissionValidator).to receive(:valid?).with(mock_bucket).and_return(true)
28
+ allow_any_instance_of(LogStash::Outputs::S3::WriteBucketPermissionValidator).to receive(:valid?).with(mock_bucket, subject.upload_options).and_return(true)
29
29
  end
30
30
 
31
31
  context "#register configuration validation" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.11
4
+ version: 4.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-18 00:00:00.000000000 Z
11
+ date: 2017-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement