fluent-plugin-s3 0.5.7 → 0.5.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78244e9e4c25288b7aa0fab1bd9bb4d5486ab91a
4
- data.tar.gz: 6c983db1d653285217036ff52c9602fac0d6c95f
3
+ metadata.gz: 0405798863dd88bb6fee3e93df98608c17afcac7
4
+ data.tar.gz: 818cef31b0406c74b18605d458836e11ecfa9fa5
5
5
  SHA512:
6
- metadata.gz: 8e6b1a38e4d36a504b7bd0fae862e7e9e43da0cc0be2b05c0fbef2ebd2c7e7643cc9f924f8bdcdd9542d365e0cc6cb756595999b3a2739500ec4899b0a687826
7
- data.tar.gz: 05a4cb5a91f41a8ee069b61154dca4bbb7ae3fa848f22663a67680091badc8bf24b6834fb8b326f7453328acd57322f81e0b14fc2b24e3a4235b6bc4c0818c18
6
+ metadata.gz: 609023d29f6ab18e9c5358268cb14eb6b61eeb27213cab73ba5e808f1c1a6b76130309e6f848e706dcaa629afdb5a58285effbe5c228a52eb095cf46d60fdf24
7
+ data.tar.gz: d227a004ec500acf936b04ff3c2e0b074bd1f366267bc30b1d0a06006bbec6e1430ed001aafd8fc5c20f11ad0ecf9e67f6eb6ae99b150347eefcbadfb64f3e67
@@ -0,0 +1,11 @@
1
+ ~*
2
+ #*
3
+ *~
4
+ [._]*.s[a-w][a-z]
5
+ .DS_Store
6
+
7
+ *.gem
8
+ .bundle
9
+ Gemfile.lock
10
+ vendor
11
+ .ruby-version
data/ChangeLog CHANGED
@@ -1,3 +1,9 @@
1
+ Release 0.5.8 - 2015/06/09
2
+
3
+ * Fix credential provider selection for env vars
4
+ * Add aws_iam_retries parameter to set number of attemps to the EC2 metadata service
5
+
6
+
1
7
  Release 0.5.7 - 2015/03/31
2
8
 
3
9
  * Use s3_endpoint instead of endpoint for S3 Client configuration for S3 compatible services
@@ -35,6 +35,8 @@ Simply use RubyGems:
35
35
 
36
36
  [aws_sec_key] AWS secret key. This parameter is required when your agent is not running on EC2 instance with an IAM Role.
37
37
 
38
+ [aws_iam_retries] The number of attempts to make (with exponential backoff) when loading instance profile credentials from the EC2 metadata service using an IAM role. Defaults to 5 retries.
39
+
38
40
  [s3_bucket (required)] S3 bucket name.
39
41
 
40
42
  [s3_region] s3 region name. For example, US West (Oregon) Region is "us-west-2". The full list of regions are available here. > http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region. We recommend using `s3_region` instead of `s3_endpoint`.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.7
1
+ 0.5.8
@@ -19,6 +19,7 @@ module Fluent
19
19
  config_param :use_server_side_encryption, :string, :default => nil
20
20
  config_param :aws_key_id, :string, :default => nil
21
21
  config_param :aws_sec_key, :string, :default => nil
22
+ config_param :aws_iam_retries, :integer, :default => 5
22
23
  config_param :s3_bucket, :string
23
24
  config_param :s3_region, :string, :default => nil
24
25
  config_param :s3_endpoint, :string, :default => nil
@@ -74,12 +75,10 @@ module Fluent
74
75
  if @aws_key_id && @aws_sec_key
75
76
  options[:access_key_id] = @aws_key_id
76
77
  options[:secret_access_key] = @aws_sec_key
78
+ elsif ENV.key? "AWS_ACCESS_KEY_ID"
79
+ options[:credential_provider] = AWS::Core::CredentialProviders::ENVProvider.new('AWS')
77
80
  else
78
- # Avoid missing credentials error from the EC2 metadata service
79
- # because of temporary loss of network connectivity when using IAM Role.
80
- # This error is a rare case, so handles it in this plugin.
81
- # retry retrieving credentials (wait for total approximately 2 min)
82
- options[:credential_provider] = AWS::Core::CredentialProviders::EC2Provider.new({:retries => 7})
81
+ options[:credential_provider] = AWS::Core::CredentialProviders::EC2Provider.new({:retries => @aws_iam_retries})
83
82
  end
84
83
  options[:region] = @s3_region if @s3_region
85
84
  options[:s3_endpoint] = @s3_endpoint if @s3_endpoint
@@ -218,7 +218,7 @@ class S3OutputTest < Test::Unit::TestCase
218
218
  data
219
219
  end
220
220
 
221
- CONFIG2 = %[
221
+ CONFIG_TIME_SLICE = %[
222
222
  hostname testing.node.local
223
223
  aws_key_id test_key_id
224
224
  aws_sec_key test_sec_key
@@ -228,17 +228,16 @@ class S3OutputTest < Test::Unit::TestCase
228
228
  path log
229
229
  utc
230
230
  buffer_type memory
231
- auto_create_bucket false
232
231
  log_level debug
233
232
  ]
234
233
 
235
- def create_time_sliced_driver(additional_conf = '')
234
+ def create_time_sliced_driver(conf = CONFIG_TIME_SLICE)
236
235
  d = Fluent::Test::TimeSlicedOutputTestDriver.new(Fluent::S3Output) do
237
236
  private
238
237
 
239
238
  def check_apikeys
240
239
  end
241
- end.configure([CONFIG2, additional_conf].join("\n"))
240
+ end.configure(conf)
242
241
  d
243
242
  end
244
243
 
@@ -304,7 +303,8 @@ class S3OutputTest < Test::Unit::TestCase
304
303
  def test_auto_create_bucket_false_with_non_existence_bucket
305
304
  s3bucket, s3bucket_col = setup_mocks
306
305
 
307
- d = create_time_sliced_driver('auto_create_bucket false')
306
+ config = CONFIG_TIME_SLICE + 'auto_create_bucket false'
307
+ d = create_time_sliced_driver(config)
308
308
  assert_raise(RuntimeError, "The specified bucket does not exist: bucket = test_bucket") {
309
309
  d.run
310
310
  }
@@ -314,9 +314,70 @@ class S3OutputTest < Test::Unit::TestCase
314
314
  s3bucket, s3bucket_col = setup_mocks
315
315
  s3bucket_col.should_receive(:create).with_any_args.and_return { true }
316
316
 
317
- d = create_time_sliced_driver('auto_create_bucket true')
318
- assert_nothing_raised {
319
- d.run
320
- }
317
+ config = CONFIG_TIME_SLICE + 'auto_create_bucket true'
318
+ d = create_time_sliced_driver(config)
319
+ assert_nothing_raised { d.run }
320
+ end
321
+
322
+ def test_aws_credential_provider_default
323
+ s3bucket, s3bucket_col = setup_mocks
324
+ s3bucket_col.should_receive(:create).with_any_args.and_return { true }
325
+
326
+ d = create_time_sliced_driver
327
+ assert_nothing_raised { d.run }
328
+ assert_equal "AWS::Core::CredentialProviders::DefaultProvider", d.instance.instance_variable_get(:@s3).config.credential_provider.class.to_s
329
+ end
330
+
331
+ def test_aws_credential_provider_env
332
+ s3bucket, s3bucket_col = setup_mocks
333
+ s3bucket_col.should_receive(:create).with_any_args.and_return { true }
334
+ key = ENV['AWS_ACCESS_KEY_ID']
335
+ ENV.replace({'AWS_ACCESS_KEY_ID' => 'my_access_key'})
336
+
337
+ config = CONFIG_TIME_SLICE.clone.split("\n").reject{|x| x =~ /.+aws_.+/}.join("\n")
338
+ d = create_time_sliced_driver(config)
339
+
340
+ assert_equal true, ENV.key?('AWS_ACCESS_KEY_ID')
341
+ assert_nothing_raised { d.run }
342
+ assert_equal nil, d.instance.aws_key_id
343
+ assert_equal nil, d.instance.aws_sec_key
344
+ assert_equal "AWS::Core::CredentialProviders::ENVProvider", d.instance.instance_variable_get(:@s3).config.credential_provider.class.to_s
345
+
346
+ ENV.replace({'AWS_ACCESS_KEY_ID' => key}) unless key.nil?
347
+ end
348
+
349
+ def test_aws_credential_provider_ec2
350
+ s3bucket, s3bucket_col = setup_mocks
351
+ s3bucket_col.should_receive(:create).with_any_args.and_return { true }
352
+ key = ENV['AWS_ACCESS_KEY_ID']
353
+ ENV.delete('AWS_ACCESS_KEY_ID')
354
+
355
+ config = CONFIG_TIME_SLICE.clone.split("\n").reject{|x| x =~ /.+aws_.+/}.join("\n")
356
+ d = create_time_sliced_driver(config)
357
+
358
+ assert_equal false, ENV.key?('AWS_ACCESS_KEY_ID')
359
+ assert_nothing_raised { d.run }
360
+ assert_equal nil, d.instance.aws_key_id
361
+ assert_equal nil, d.instance.aws_sec_key
362
+ assert_equal "AWS::Core::CredentialProviders::EC2Provider", d.instance.instance_variable_get(:@s3).config.credential_provider.class.to_s
363
+ assert_equal 5, d.instance.instance_variable_get(:@s3).config.credential_provider.retries
364
+
365
+ ENV.replace({'AWS_ACCESS_KEY_ID' => key}) unless key.nil?
366
+ end
367
+
368
+ def test_aws_credential_provider_ec2_with_retries
369
+ s3bucket, s3bucket_col = setup_mocks
370
+ s3bucket_col.should_receive(:create).with_any_args.and_return { true }
371
+ key = ENV['AWS_ACCESS_KEY_ID']
372
+ ENV.delete('AWS_ACCESS_KEY_ID')
373
+
374
+ config = [CONFIG_TIME_SLICE.clone.split("\n").reject{|x| x =~ /.+aws_.+/}, 'aws_iam_retries 7'].join("\n")
375
+ d = create_time_sliced_driver(config)
376
+
377
+ config = [CONFIG, 'include_tag_key true', 'include_time_key true'].join("\n")
378
+ assert_nothing_raised { d.run }
379
+ assert_equal 7, d.instance.instance_variable_get(:@s3).config.credential_provider.retries
380
+
381
+ ENV.replace({'AWS_ACCESS_KEY_ID' => key}) unless key.nil?
321
382
  end
322
383
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.7
4
+ version: 0.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-03-31 00:00:00.000000000 Z
12
+ date: 2015-06-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd
@@ -121,6 +121,7 @@ executables: []
121
121
  extensions: []
122
122
  extra_rdoc_files: []
123
123
  files:
124
+ - ".gitignore"
124
125
  - ".travis.yml"
125
126
  - AUTHORS
126
127
  - ChangeLog