sensu 0.13.0.alpha → 0.13.0.alpha.1

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: 0e1b021d3461d4daef8432adea63250ae659bb10
4
- data.tar.gz: b00ffdcb7989eba387b66777b5b6cd04abf1264d
3
+ metadata.gz: 1c545c1cfe6cab6e0d221ae034680947c39aa6b6
4
+ data.tar.gz: ec92277b4be277c058b8b244f5e07c91a8ac4d64
5
5
  SHA512:
6
- metadata.gz: d324be84c52252df92c88c1e1691a4917aba28c29c520a482ea27b4c46c7c3fcfe30a569cde6cd6464ecaecf631fee7f86b9cc99186ec5d6725cb27a8c9af7f0
7
- data.tar.gz: 1c0d83d4bcf511709f0abed6624e293ad5037a32e3f221225c46247ebef1284fc5a332aaa3013b951b075b4233c85a9bdb3e94f9e1f60338a3a1f5da4ec07094
6
+ metadata.gz: 1e6a1ff938fc9149c8567ce7ddd981da5cb15a895dcd629446375960564894e5b7ed3745aaea70612570cfdcf828fe8e8db1c0d8e99b1ecfce07b31f68022b37
7
+ data.tar.gz: 4fd59781a991385d0d346b74e902fab82038fc5c260a969fbc0e5d7b8ff2837450cb09c515561cb3ec1c5bf3a107f8b25fc3fa922d03a9c2f233dbbcc95ff18e
@@ -1,10 +1,13 @@
1
1
  require 'sensu/daemon'
2
2
 
3
- gem 'thin', '1.5.0'
4
3
  gem 'sinatra', '1.3.5'
5
4
  gem 'async_sinatra', '1.0.0'
6
5
 
7
- require 'thin'
6
+ unless RUBY_PLATFORM =~ /java/
7
+ gem 'thin', '1.5.0'
8
+ require 'thin'
9
+ end
10
+
8
11
  require 'sinatra/async'
9
12
 
10
13
  module Sensu
@@ -16,41 +19,66 @@ module Sensu
16
19
 
17
20
  def run(options={})
18
21
  bootstrap(options)
22
+ setup_process(options)
19
23
  EM::run do
20
24
  start
21
25
  setup_signal_traps
22
26
  end
23
27
  end
24
28
 
29
+ def on_reactor_run
30
+ EM::next_tick do
31
+ setup_redis
32
+ set :redis, @redis
33
+ setup_transport
34
+ set :transport, @transport
35
+ end
36
+ end
37
+
25
38
  def bootstrap(options)
26
39
  setup_logger(options)
27
40
  set :logger, @logger
28
41
  load_settings(options)
42
+ set :checks, @settings[:checks]
43
+ set :all_checks, @settings.checks
29
44
  if @settings[:api][:user] && @settings[:api][:password]
30
45
  use Rack::Auth::Basic do |user, password|
31
46
  user == @settings[:api][:user] && password == @settings[:api][:password]
32
47
  end
33
48
  end
34
- set :checks, @settings[:checks]
35
- set :all_checks, @settings.checks
36
- setup_process(options)
49
+ on_reactor_run
50
+ self
37
51
  end
38
52
 
39
- def start
40
- setup_redis
41
- set :redis, @redis
42
- setup_transport
43
- set :transport, @transport
53
+ def start_server
44
54
  Thin::Logging.silent = true
45
55
  bind = @settings[:api][:bind] || '0.0.0.0'
46
- Thin::Server.start(bind, @settings[:api][:port], self)
56
+ @thin = Thin::Server.new(bind, @settings[:api][:port], self)
57
+ @thin.start
58
+ end
59
+
60
+ def stop_server(&block)
61
+ @thin.stop
62
+ retry_until_true do
63
+ unless @thin.running?
64
+ block.call
65
+ true
66
+ end
67
+ end
68
+ end
69
+
70
+ def start
71
+ start_server
72
+ super
47
73
  end
48
74
 
49
75
  def stop
50
76
  @logger.warn('stopping')
51
- @redis.close
52
- @transport.close
53
- super
77
+ stop_server do
78
+ @redis.close
79
+ @transport.close
80
+ super
81
+ end
54
82
  end
55
83
 
56
84
  def test(options={})
@@ -1,6 +1,6 @@
1
1
  module Sensu
2
2
  unless defined?(Sensu::VERSION)
3
- VERSION = '0.13.0.alpha'
3
+ VERSION = '0.13.0.alpha.1'
4
4
 
5
5
  SEVERITIES = %w[ok warning critical unknown]
6
6
 
@@ -24,9 +24,9 @@ Gem::Specification.new do |s|
24
24
  s.add_dependency('sensu-transport', '0.0.2')
25
25
  s.add_dependency('sensu-spawn', '0.0.3')
26
26
  s.add_dependency('em-redis-unified', '0.4.2')
27
- s.add_dependency('thin', '1.5.0')
28
27
  s.add_dependency('sinatra', '1.3.5')
29
28
  s.add_dependency('async_sinatra', '1.0.0')
29
+ s.add_dependency('thin', '1.5.0') unless RUBY_PLATFORM =~ /java/
30
30
 
31
31
  s.add_development_dependency('rake')
32
32
  s.add_development_dependency('rspec')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0.alpha
4
+ version: 0.13.0.alpha.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Porter
@@ -152,47 +152,47 @@ dependencies:
152
152
  - !ruby/object:Gem::Version
153
153
  version: 0.4.2
154
154
  - !ruby/object:Gem::Dependency
155
- name: thin
155
+ name: sinatra
156
156
  requirement: !ruby/object:Gem::Requirement
157
157
  requirements:
158
158
  - - '='
159
159
  - !ruby/object:Gem::Version
160
- version: 1.5.0
160
+ version: 1.3.5
161
161
  type: :runtime
162
162
  prerelease: false
163
163
  version_requirements: !ruby/object:Gem::Requirement
164
164
  requirements:
165
165
  - - '='
166
166
  - !ruby/object:Gem::Version
167
- version: 1.5.0
167
+ version: 1.3.5
168
168
  - !ruby/object:Gem::Dependency
169
- name: sinatra
169
+ name: async_sinatra
170
170
  requirement: !ruby/object:Gem::Requirement
171
171
  requirements:
172
172
  - - '='
173
173
  - !ruby/object:Gem::Version
174
- version: 1.3.5
174
+ version: 1.0.0
175
175
  type: :runtime
176
176
  prerelease: false
177
177
  version_requirements: !ruby/object:Gem::Requirement
178
178
  requirements:
179
179
  - - '='
180
180
  - !ruby/object:Gem::Version
181
- version: 1.3.5
181
+ version: 1.0.0
182
182
  - !ruby/object:Gem::Dependency
183
- name: async_sinatra
183
+ name: thin
184
184
  requirement: !ruby/object:Gem::Requirement
185
185
  requirements:
186
186
  - - '='
187
187
  - !ruby/object:Gem::Version
188
- version: 1.0.0
188
+ version: 1.5.0
189
189
  type: :runtime
190
190
  prerelease: false
191
191
  version_requirements: !ruby/object:Gem::Requirement
192
192
  requirements:
193
193
  - - '='
194
194
  - !ruby/object:Gem::Version
195
- version: 1.0.0
195
+ version: 1.5.0
196
196
  - !ruby/object:Gem::Dependency
197
197
  name: rake
198
198
  requirement: !ruby/object:Gem::Requirement