cf_light_api 2.6.0.pre2 → 2.6.0.pre3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cf_light_api/worker.rb +22 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98cdbae3a37af7f2695450f99b73a07aaa28c478
|
4
|
+
data.tar.gz: b9fa101e8523f7a7d28c2f320ce89474cbd55f83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20e105700cdff0123f2471db9d34f13aaaef84613186ad9fb5095fbcf91df4023ea79fab2848661f7b2a47edb6d263d32d9c1c71ed709de56519f68f0d1730e1
|
7
|
+
data.tar.gz: 6c5d2ab591c958a40bb8430e9a25db23ed420f43946b4d0fb06169cc6ed013d8fd2834832f34836615cc390fa9598c31bcedcdce6e022e4f6b825c569ed097ca
|
data/lib/cf_light_api/worker.rb
CHANGED
@@ -74,7 +74,18 @@ class CFLightAPIWorker
|
|
74
74
|
@logger.info "Making #{method} request for #{path}..."
|
75
75
|
|
76
76
|
resources = []
|
77
|
-
|
77
|
+
options = {:accept => :json}
|
78
|
+
response = @cf_client.base.rest_client.request(method, path, options)[1][:body]
|
79
|
+
|
80
|
+
begin
|
81
|
+
response = JSON.parse(response)
|
82
|
+
rescue Rufus::Scheduler::TimeoutError => e
|
83
|
+
raise e
|
84
|
+
rescue StandardError => e
|
85
|
+
@logger.info "Error parsing JSON response from #{method} request for #{path}: #{e.message}"
|
86
|
+
@logger.error e.backtrace
|
87
|
+
raise "Invalid JSON response from CF for #{method} #{path}"
|
88
|
+
end
|
78
89
|
|
79
90
|
# Some endpoints return a 'resources' array, others are flat, depending on the path.
|
80
91
|
if response['resources']
|
@@ -146,8 +157,15 @@ class CFLightAPIWorker
|
|
146
157
|
host = route['entity']['host']
|
147
158
|
path = route['entity']['path']
|
148
159
|
|
149
|
-
domain =
|
150
|
-
|
160
|
+
domain = ''
|
161
|
+
begin
|
162
|
+
domain = @domains.find{|a_domain| a_domain['metadata']['guid'] == route['entity']['domain_guid']}
|
163
|
+
domain = domain['entity']['name']
|
164
|
+
rescue Rufus::Scheduler::TimeoutError => e
|
165
|
+
raise e
|
166
|
+
rescue StandardError => e
|
167
|
+
raise "Unable to determine domain for route #{route['metadata']['url']}"
|
168
|
+
end
|
151
169
|
|
152
170
|
"#{host}.#{domain}#{path}"
|
153
171
|
end
|
@@ -264,6 +282,7 @@ class CFLightAPIWorker
|
|
264
282
|
# for example, trying to query an app which was present when the worker began updating, but was stopped
|
265
283
|
# before we reached this section, so we just catch all exceptions, log the reason and move on.
|
266
284
|
@logger.info " #{org['entity']['name']} #{space['entity']['name']}: '#{app['entity']['name']}' error: #{e.message}"
|
285
|
+
@logger.error e.backtrace
|
267
286
|
additional_data = {
|
268
287
|
:running => 'error',
|
269
288
|
:instances => [],
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cf_light_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.0.
|
4
|
+
version: 2.6.0.pre3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Springer Platform Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cfoundry
|