sensu 0.9.5.beta.1 → 0.9.5.beta.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/sensu.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sensu
2
- VERSION = "0.9.5.beta.1"
2
+ VERSION = "0.9.5.beta.2"
3
3
  end
data/lib/sensu/api.rb CHANGED
@@ -40,6 +40,19 @@ module Sensu
40
40
  $logger.debug('[setup] -- connecting to rabbitmq')
41
41
  $rabbitmq = AMQP.connect($settings.rabbitmq.to_hash.symbolize_keys)
42
42
  $amq = AMQP::Channel.new($rabbitmq)
43
+ if $settings.api.user && $settings.api.password
44
+ use Rack::Auth::Basic do |user, password|
45
+ user == $settings.api.user && password == $settings.api.password
46
+ end
47
+ end
48
+ end
49
+
50
+ configure do
51
+ disable :protection
52
+ end
53
+
54
+ not_found do
55
+ ''
43
56
  end
44
57
 
45
58
  before do
data/lib/sensu/config.rb CHANGED
@@ -127,6 +127,19 @@ module Sensu
127
127
  end
128
128
  end
129
129
 
130
+ def validate_api_settings
131
+ if @settings.api.key?('user')
132
+ unless @settings.api.user.is_a?(String)
133
+ invalid_config('api user must be a string')
134
+ end
135
+ end
136
+ if @settings.api.key?('password')
137
+ unless @settings.api.password.is_a?(String)
138
+ invalid_config('api password must be a string')
139
+ end
140
+ end
141
+ end
142
+
130
143
  def validate_client_settings
131
144
  unless @settings.client.name.is_a?(String)
132
145
  invalid_config('client must have a name')
@@ -155,12 +168,14 @@ module Sensu
155
168
  when 'rake'
156
169
  has_keys(%w[redis api handlers client])
157
170
  validate_server_settings
171
+ validate_api_settings
158
172
  validate_client_settings
159
173
  when 'sensu-server'
160
- has_keys(%w[redis handlers])
174
+ has_keys(%w[handlers])
161
175
  validate_server_settings
162
176
  when 'sensu-api'
163
- has_keys(%w[redis api])
177
+ has_keys(%w[api])
178
+ validate_api_settings
164
179
  when 'sensu-client'
165
180
  has_keys(%w[client])
166
181
  validate_client_settings
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu
3
3
  version: !ruby/object:Gem::Version
4
- hash: 62196249
4
+ hash: 62196255
5
5
  prerelease: true
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
9
  - 5
10
10
  - beta
11
- - 1
12
- version: 0.9.5.beta.1
11
+ - 2
12
+ version: 0.9.5.beta.2
13
13
  platform: ruby
14
14
  authors:
15
15
  - Sean Porter
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2012-03-05 00:00:00 -08:00
21
+ date: 2012-03-06 00:00:00 -08:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency