Skip to content

Commit

Permalink
add some compatibility for logstash 6.x and ruby 2.x
Browse files Browse the repository at this point in the history
* make input helper use new_pipeline_from_string
* make return of input helper lambda explicit
  • Loading branch information
jsvd committed May 31, 2017
1 parent 9ee0c8a commit 0217672
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## 1.3.3
- Make input function support different pipeline constructor signatures - for compatibility with logstash-core 6.0
- Make return of lambda used in input helpers explicit

## 1.3.2
- Make sample function with multiple pipelines - for compatibility with logstash-core 6.0
- Make sample function support different pipeline constructor signatures - for compatibility with logstash-core 6.0

## 1.3.1
- Close pipeline after #sample helper - for compatibility with logstash-core 5.3
Expand Down
6 changes: 5 additions & 1 deletion lib/logstash/devutils/rspec/logstash_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def sample(sample_event, &block)
end # def sample

def input(config, &block)
pipeline = LogStash::Pipeline.new(config)
pipeline = new_pipeline_from_string(config)
queue = Queue.new

pipeline.instance_eval do
Expand All @@ -82,6 +82,10 @@ def input(config, &block)
# output_func is now a method, call closure
def output_func(event)
@output_func.call(event)
# We want to return nil or [] since outputs aren't used here
# NOTE: In Ruby 1.9.x, Queue#<< returned nil, but in 2.x it returns the queue itself
# So we need to be explicit about the return
nil
end
end

Expand Down
2 changes: 1 addition & 1 deletion logstash-devutils.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
files = %x{git ls-files}.split("\n")

spec.name = "logstash-devutils"
spec.version = "1.3.2"
spec.version = "1.3.3"
spec.licenses = ["Apache License (2.0)"]
spec.summary = "logstash-devutils"
spec.description = "logstash-devutils"
Expand Down

0 comments on commit 0217672

Please sign in to comment.