logstash-input-github 3.0.5 → 3.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/LICENSE +1 -1
- data/lib/logstash/inputs/github.rb +10 -3
- data/logstash-input-github.gemspec +2 -2
- data/spec/inputs/github_spec.rb +47 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89741b6fc51325a40f005b06e565f3d031f324ed945287b903ec78c6bbe71bdb
|
4
|
+
data.tar.gz: 0bcc0471434fa5ba5b53b629d6c9522a7a3c86eae55d30e2be361db3e41efb1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a2997975c0f9c08728c1f464ff1c21177d4be29cd88d54d892220f46aa5a1575aec894668d99884a508eef72636896ed7b7048e36e91580a438f3252566ac41
|
7
|
+
data.tar.gz: '099e04e6b110a62da462e8472e7480943d75e6a45664e669194803afd421696b050f1edb67deec4af3c289426d84eeeb5ec4fa076e74fcce8b60d7fa2ab0c5a0'
|
data/CHANGELOG.md
CHANGED
data/LICENSE
CHANGED
@@ -42,6 +42,13 @@ class LogStash::Inputs::GitHub < LogStash::Inputs::Base
|
|
42
42
|
response.body = "Accepted!"
|
43
43
|
end
|
44
44
|
@server.run
|
45
|
+
rescue Exception => original_exception
|
46
|
+
# If our server crashes, it may not have cleaned up after itself;
|
47
|
+
# since `FTW::WebServer#stop` is idempotent, make one last attempt
|
48
|
+
# before propagating the original exception.
|
49
|
+
@server && @server.stop rescue logger.error("Error while stopping FTW::WebServer", exception: $!.message, backtrace: $!.backtrace)
|
50
|
+
|
51
|
+
raise original_exception
|
45
52
|
end # def run
|
46
53
|
|
47
54
|
def build_event_from_request(body, headers)
|
@@ -69,8 +76,8 @@ class LogStash::Inputs::GitHub < LogStash::Inputs::Base
|
|
69
76
|
return is_valid
|
70
77
|
end
|
71
78
|
|
72
|
-
def
|
73
|
-
@server.stop
|
74
|
-
end # def
|
79
|
+
def stop
|
80
|
+
@server && @server.stop
|
81
|
+
end # def stop
|
75
82
|
|
76
83
|
end # class LogStash::Inputs::Github
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-input-github'
|
4
|
-
s.version = '3.0.
|
4
|
+
s.version = '3.0.6'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "Reads events from a GitHub webhook"
|
7
7
|
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"
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
|
25
25
|
s.add_runtime_dependency 'addressable'
|
26
26
|
s.add_runtime_dependency 'logstash-codec-plain'
|
27
|
-
s.add_runtime_dependency 'ftw', '~> 0.0.
|
27
|
+
s.add_runtime_dependency 'ftw', '~> 0.0.48'
|
28
28
|
|
29
29
|
s.add_development_dependency 'logstash-devutils'
|
30
30
|
end
|
data/spec/inputs/github_spec.rb
CHANGED
@@ -55,4 +55,51 @@ describe LogStash::Inputs::GitHub do
|
|
55
55
|
end
|
56
56
|
|
57
57
|
end
|
58
|
+
|
59
|
+
describe 'graceful shutdown' do
|
60
|
+
context 'when underlying webserver crashes' do
|
61
|
+
|
62
|
+
# Stubbing out our FTW::WebServer allows us to force it to raise an exception when we try to run it.
|
63
|
+
let(:mock_webserver_class) { double('FTW::WebServer::class').as_null_object }
|
64
|
+
let(:mock_webserver) { double('FTW::WebServer').as_null_object }
|
65
|
+
before(:each) do
|
66
|
+
stub_const('FTW::WebServer', mock_webserver_class)
|
67
|
+
allow(mock_webserver_class).to receive(:new).and_return(mock_webserver)
|
68
|
+
expect(mock_webserver).to receive(:run).and_raise('testing: intentional uncaught exception')
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'makes an attempt to stop the webserver' do
|
72
|
+
expect(mock_webserver).to receive(:stop)
|
73
|
+
|
74
|
+
plugin.run([]) rescue nil
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'propagates the original exception' do
|
78
|
+
expect do
|
79
|
+
plugin.run([])
|
80
|
+
end.to raise_exception('testing: intentional uncaught exception')
|
81
|
+
end
|
82
|
+
|
83
|
+
context 'and an attempt to stop the webserver also crashes' do
|
84
|
+
let(:mock_logger) { double('Logger').as_null_object }
|
85
|
+
before(:each) do
|
86
|
+
allow(plugin).to receive(:logger).and_return(mock_logger)
|
87
|
+
allow(mock_webserver).to receive(:stop).and_raise('yo dawg')
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'logs helpfully' do
|
91
|
+
expect(mock_logger).to receive(:error).with("Error while stopping FTW::WebServer",
|
92
|
+
exception: 'yo dawg', backtrace: instance_of(Array))
|
93
|
+
|
94
|
+
plugin.run([]) rescue nil
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'propagates the original exception' do
|
98
|
+
expect do
|
99
|
+
plugin.run([])
|
100
|
+
end.to raise_exception('testing: intentional uncaught exception')
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
58
105
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-github
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -63,7 +63,7 @@ dependencies:
|
|
63
63
|
requirements:
|
64
64
|
- - "~>"
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: 0.0.
|
66
|
+
version: 0.0.48
|
67
67
|
name: ftw
|
68
68
|
prerelease: false
|
69
69
|
type: :runtime
|
@@ -71,7 +71,7 @@ dependencies:
|
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 0.0.
|
74
|
+
version: 0.0.48
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
requirement: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
128
|
version: '0'
|
129
129
|
requirements: []
|
130
130
|
rubyforge_project:
|
131
|
-
rubygems_version: 2.6.
|
131
|
+
rubygems_version: 2.6.13
|
132
132
|
signing_key:
|
133
133
|
specification_version: 4
|
134
134
|
summary: Reads events from a GitHub webhook
|