cf_light_api 2.6.0.pre2 → 2.6.0.pre3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cf_light_api/worker.rb +22 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 06b2d8bbee9ce02ce4e63d45779b4e13aae119c1
4
- data.tar.gz: 546c062c1856166a97833c57a48e8aca14a96b0e
3
+ metadata.gz: 98cdbae3a37af7f2695450f99b73a07aaa28c478
4
+ data.tar.gz: b9fa101e8523f7a7d28c2f320ce89474cbd55f83
5
5
  SHA512:
6
- metadata.gz: faa6ae8ccaee6f7d212748542d7f7d0033bdfc2b322a6a9f0d2363fcaf1fa2a5377be2d72488eb2a4a2e5ed9c4b313ddf534d7d61b3427de9fff2a7df5be1d3c
7
- data.tar.gz: 1912ca0b9733f6ab8bf9f3581d1c4d6908675e2d9de29107d324cff939eb799282dc5541449439e888a7e347ea03f7f61fa06f1e57fe90ca399b5a492afbbe31
6
+ metadata.gz: 20e105700cdff0123f2471db9d34f13aaaef84613186ad9fb5095fbcf91df4023ea79fab2848661f7b2a47edb6d263d32d9c1c71ed709de56519f68f0d1730e1
7
+ data.tar.gz: 6c5d2ab591c958a40bb8430e9a25db23ed420f43946b4d0fb06169cc6ed013d8fd2834832f34836615cc390fa9598c31bcedcdce6e022e4f6b825c569ed097ca
@@ -74,7 +74,18 @@ class CFLightAPIWorker
74
74
  @logger.info "Making #{method} request for #{path}..."
75
75
 
76
76
  resources = []
77
- response = JSON.parse(@cf_client.base.rest_client.request(method, path)[1][:body])
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 = @domains.find{|a_domain| a_domain['metadata']['guid'] == route['entity']['domain_guid']}
150
- domain = domain['entity']['name']
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.pre2
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-29 00:00:00.000000000 Z
11
+ date: 2017-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cfoundry