cfoundry 0.3.49 → 0.3.50
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cfoundry/baseclient.rb +1 -1
- data/lib/cfoundry/v1/app.rb +1 -0
- data/lib/cfoundry/v2/app.rb +28 -6
- data/lib/cfoundry/v2/domain.rb +1 -0
- data/lib/cfoundry/version.rb +1 -1
- metadata +4 -4
data/lib/cfoundry/baseclient.rb
CHANGED
data/lib/cfoundry/v1/app.rb
CHANGED
data/lib/cfoundry/v2/app.rb
CHANGED
@@ -155,18 +155,40 @@ module CFoundry::V2
|
|
155
155
|
#
|
156
156
|
# Otherwise, returns application's status.
|
157
157
|
def health
|
158
|
-
state
|
158
|
+
if state == "STARTED"
|
159
|
+
healthy_count = running_instances
|
160
|
+
expected = total_instances
|
161
|
+
|
162
|
+
if expected > 0
|
163
|
+
ratio = healthy_count / expected.to_f
|
164
|
+
if ratio == 1.0
|
165
|
+
"RUNNING"
|
166
|
+
else
|
167
|
+
"#{(ratio * 100).to_i}%"
|
168
|
+
end
|
169
|
+
else
|
170
|
+
"N/A"
|
171
|
+
end
|
172
|
+
else
|
173
|
+
state
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
def running_instances
|
178
|
+
running = 0
|
179
|
+
|
180
|
+
instances.each do |i|
|
181
|
+
running += 1 if i.state == "RUNNING"
|
182
|
+
end
|
183
|
+
|
184
|
+
running
|
159
185
|
end
|
160
186
|
|
161
187
|
# Check that all application instances are running.
|
162
188
|
def healthy?
|
163
189
|
# invalidate cache so the check is fresh
|
164
190
|
@manifest = nil
|
165
|
-
|
166
|
-
case health
|
167
|
-
when "RUNNING", "STARTED"
|
168
|
-
true
|
169
|
-
end
|
191
|
+
health == "RUNNING"
|
170
192
|
end
|
171
193
|
alias_method :running?, :healthy?
|
172
194
|
|
data/lib/cfoundry/v2/domain.rb
CHANGED
data/lib/cfoundry/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cfoundry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 119
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 50
|
10
|
+
version: 0.3.50
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Alex Suraci
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-10-
|
18
|
+
date: 2012-10-29 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: multipart-post
|