Skip to content

Commit d86be02

Browse files
authored
Refactoring, reuse shared code for additional_settings (#237)
Refactoring, starting from version 5.1.0 of mixin-aws it includes the shared logic for symbolization of additional_settings, this commit updates the dependency and fix the code to reuse that.
1 parent 909787d commit d86be02

File tree

3 files changed

+6
-23
lines changed

3 files changed

+6
-23
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 3.8.4
2+
- Refactoring, reuse code to manage `additional_settings` from mixin-aws [#n](https://github.com/logstash-plugins/logstash-input-s3/pull/n)
3+
14
## 3.8.3
25
- Fix missing `metadata` and `type` of the last event [#223](https://github.com/logstash-plugins/logstash-input-s3/pull/223)
36

lib/logstash/inputs/s3.rb

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -357,25 +357,6 @@ def sincedb_file
357357
path
358358
end
359359

360-
def symbolized_settings
361-
@symbolized_settings ||= symbolize_keys_and_cast_true_false(@additional_settings)
362-
end
363-
364-
def symbolize_keys_and_cast_true_false(hash)
365-
case hash
366-
when Hash
367-
symbolized = {}
368-
hash.each { |key, value| symbolized[key.to_sym] = symbolize_keys_and_cast_true_false(value) }
369-
symbolized
370-
when 'true'
371-
true
372-
when 'false'
373-
false
374-
else
375-
hash
376-
end
377-
end
378-
379360
def ignore_filename?(filename)
380361
if @prefix == filename
381362
return true
@@ -441,8 +422,7 @@ def delete_file_from_bucket(object)
441422
end
442423

443424
def get_s3object
444-
options = symbolized_settings.merge(aws_options_hash || {})
445-
s3 = Aws::S3::Resource.new(options)
425+
s3 = Aws::S3::Resource.new(aws_options_hash || {})
446426
end
447427

448428
def file_restored?(object)

logstash-input-s3.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Gem::Specification.new do |s|
22

33
s.name = 'logstash-input-s3'
4-
s.version = '3.8.3'
4+
s.version = '3.8.4'
55
s.licenses = ['Apache-2.0']
66
s.summary = "Streams events from files in a S3 bucket"
77
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"
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
2121

2222
# Gem dependencies
2323
s.add_runtime_dependency "logstash-core-plugin-api", ">= 2.1.12", "<= 2.99"
24-
s.add_runtime_dependency 'logstash-mixin-aws', '>= 4.3.0'
24+
s.add_runtime_dependency 'logstash-mixin-aws', '>= 5.1.0'
2525
s.add_runtime_dependency 'stud', '~> 0.0.18'
2626
# s.add_runtime_dependency 'aws-sdk-resources', '>= 2.0.33'
2727
s.add_development_dependency 'logstash-devutils'

0 commit comments

Comments
 (0)