Merge lp:~johnsca/charms/trusty/cloudfoundry/catchup into lp:~cf-charmers/charms/trusty/cloudfoundry/trunk
- Trusty Tahr (14.04)
- catchup
- Merge into trunk
Proposed by
Cory Johns
Status: | Merged |
---|---|
Merged at revision: | 164 |
Proposed branch: | lp:~johnsca/charms/trusty/cloudfoundry/catchup |
Merge into: | lp:~cf-charmers/charms/trusty/cloudfoundry/trunk |
Diff against target: |
675 lines (+321/-30) 11 files modified
.bzrignore (+4/-0) charmgen/generator.py (+4/-0) charmgen/placements.yaml (+1/-1) cloudfoundry/contexts.py (+58/-5) cloudfoundry/releases.py (+41/-5) cloudfoundry/services.py (+172/-0) cloudfoundry/utils.py (+3/-1) reconciler/app.py (+2/-0) reconciler/strategy.py (+11/-2) tests/02-cats (+1/-1) tests/cats.py (+24/-15) |
To merge this branch: | bzr merge lp:~johnsca/charms/trusty/cloudfoundry/catchup |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Benjamin Saller (community) | Approve | ||
Review via email: mp+244226@code.launchpad.net |
Commit message
Description of the change
Changes to support 190. I haven't run CATS on it, but pushing an app and logging works.
To post a comment you must log in.
- 171. By Cory Johns
-
Fixes for CATs test to match cfdeploy changes
- 172. By Cory Johns
-
Fixes for running CATs
- 173. By Cory Johns
-
Test arg needs to be optional
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2014-11-13 16:22:27 +0000 |
3 | +++ .bzrignore 2014-12-10 15:53:53 +0000 |
4 | @@ -47,3 +47,7 @@ |
5 | # Generated test charms |
6 | cloudfoundry-r* |
7 | output-v*.yaml |
8 | + |
9 | +# Generated when running CATs |
10 | +src/ |
11 | +pkg/ |
12 | |
13 | === modified file 'charmgen/generator.py' |
14 | --- charmgen/generator.py 2014-11-07 21:50:48 +0000 |
15 | +++ charmgen/generator.py 2014-12-10 15:53:53 +0000 |
16 | @@ -227,6 +227,10 @@ |
17 | if zone: |
18 | driver = zone[0] |
19 | for follower in zone[1:]: |
20 | + if follower not in services: |
21 | + # allow dangling references in placement to handle |
22 | + # removed services |
23 | + continue |
24 | with_references.add(driver) |
25 | if 'to' not in services[follower]: |
26 | services[follower]['to'] = [driver] |
27 | |
28 | === modified file 'charmgen/placements.yaml' |
29 | --- charmgen/placements.yaml 2014-11-11 03:52:11 +0000 |
30 | +++ charmgen/placements.yaml 2014-12-10 15:53:53 +0000 |
31 | @@ -5,7 +5,7 @@ |
32 | b: [router, nats, nats-sf] |
33 | c: [login, uaa, mysql] |
34 | d: [dea, hm, etcd] |
35 | - e: [loggregator, loggregator-trafficcontrol] |
36 | + e: [loggregator-trafficcontrol, loggregator, doppler] |
37 | f: [haproxy, collector] |
38 | local: |
39 | __default__: |
40 | |
41 | === modified file 'cloudfoundry/contexts.py' |
42 | --- cloudfoundry/contexts.py 2014-11-11 04:02:53 +0000 |
43 | +++ cloudfoundry/contexts.py 2014-12-10 15:53:53 +0000 |
44 | @@ -226,7 +226,7 @@ |
45 | |
46 | class LoginRelation(RelationContext): |
47 | name = 'login' |
48 | - interface = 'http' |
49 | + interface = 'login' |
50 | required_keys = [] |
51 | port = 8080 |
52 | |
53 | @@ -239,6 +239,8 @@ |
54 | data = self[self.name][0] |
55 | return { |
56 | 'login.port': data['port'], |
57 | + 'login.saml.socket.connectionManagerTimeout': 10000, |
58 | + 'login.saml.socket.soTimeout': 10000, |
59 | } |
60 | |
61 | |
62 | @@ -250,6 +252,11 @@ |
63 | def erb_mapping(self): |
64 | return { |
65 | 'dea_next.directory_server_protocol': 'http', |
66 | + # these are the default values, but since they're used in hm and |
67 | + # cc and those specs don't give the default value (only dea_next), |
68 | + # we have to manually specify them here |
69 | + 'dea_next.advertise_interval_in_seconds': 5, |
70 | + 'dea_next.heartbeat_interval_in_seconds': 10, |
71 | } |
72 | |
73 | |
74 | @@ -296,8 +303,6 @@ |
75 | 'traffic_controller.host': data[0]['host'], |
76 | 'traffic_controller.incoming_port': data[0]['port'], |
77 | 'traffic_controller.outgoing_port': data[0]['outgoing_port'], |
78 | - 'logger_endpoint.use_ssl': False, # TODO: support SSL option |
79 | - 'logger_endpoint.port': 80, # default is 443 |
80 | } |
81 | |
82 | |
83 | @@ -328,6 +333,48 @@ |
84 | } |
85 | |
86 | |
87 | +class DopplerRelation(RelationContext): |
88 | + name = 'doppler' |
89 | + interface = 'doppler' |
90 | + required_keys = ['address', 'incoming_port', 'outgoing_port', |
91 | + 'dropsonde_port', 'doppler_endpoint_secret'] |
92 | + incoming_port = 3457 |
93 | + outgoing_port = 8083 |
94 | + dropsonde_port = 3460 |
95 | + |
96 | + def get_shared_secrets(self): |
97 | + secret_context = StoredContext('doppler-secrets.yml', { |
98 | + 'doppler_endpoint_secret': host.pwgen(20), |
99 | + }) |
100 | + return secret_context |
101 | + |
102 | + def provide_data(self): |
103 | + secrets = self.get_shared_secrets() |
104 | + return { |
105 | + 'address': hookenv.unit_get('private-address').encode('utf-8'), |
106 | + 'incoming_port': self.incoming_port, |
107 | + 'outgoing_port': self.outgoing_port, |
108 | + 'dropsonde_port': self.dropsonde_port, |
109 | + 'doppler_endpoint_secret': secrets['doppler_endpoint_secret'] |
110 | + } |
111 | + |
112 | + def erb_mapping(self): |
113 | + data = self[self.name] |
114 | + return { |
115 | + 'doppler.zone': 'z1', |
116 | + 'doppler.blacklisted_syslog_ranges': [], |
117 | + 'doppler.incoming_port': data[0]['incoming_port'], |
118 | + 'doppler.outgoing_port': data[0]['outgoing_port'], |
119 | + 'doppler.dropsonde_incoming_port': data[0]['dropsonde_port'], |
120 | + 'doppler_endpoint.shared_secret': data[0]['doppler_endpoint_secret'], |
121 | + 'loggregator.doppler_port': data[0]['outgoing_port'], |
122 | + 'loggregator.incoming_port': data[0]['incoming_port'], |
123 | + 'loggregator.dropsonde_incoming_port': data[0]['dropsonde_port'], |
124 | + 'loggregator.dropsonde_outgoing_port': data[0]['outgoing_port'], |
125 | + 'loggregator_endpoint.shared_secret': data[0]['doppler_endpoint_secret'], |
126 | + } |
127 | + |
128 | + |
129 | class EtcdRelation(RelationContext): |
130 | name = 'etcd' |
131 | interface = 'etcd' |
132 | @@ -343,13 +390,15 @@ |
133 | class CloudControllerRelation(RelationContext): |
134 | name = 'cc' |
135 | interface = 'controller' |
136 | - required_keys = ['hostname', 'port', 'user', 'password', 'db_encryption_key'] |
137 | + required_keys = ['hostname', 'port', 'user', 'password', |
138 | + 'internal_api_password', 'db_encryption_key'] |
139 | |
140 | def get_credentials(self): |
141 | return StoredContext('api_credentials.yml', { |
142 | 'user': host.pwgen(7), |
143 | 'password': host.pwgen(7), |
144 | 'db_encryption_key': host.pwgen(7), |
145 | + 'internal_api_password': host.pwgen(7), |
146 | }) |
147 | |
148 | def provide_data(self): |
149 | @@ -357,6 +406,7 @@ |
150 | return { |
151 | 'user': creds['user'], |
152 | 'password': creds['password'], |
153 | + 'internal_api_password': creds['internal_api_password'], |
154 | 'db_encryption_key': creds['db_encryption_key'], |
155 | 'hostname': hookenv.unit_get('private-address').encode('utf-8'), |
156 | 'port': 9022, |
157 | @@ -369,6 +419,7 @@ |
158 | 'cc.srv_api_uri': 'http://{}:{}'.format(data['hostname'], data['port']), |
159 | 'cc.bulk_api_user': data['user'], |
160 | 'cc.bulk_api_password': data['password'], |
161 | + 'cc.internal_api_password': data['internal_api_password'], |
162 | 'cc.staging_upload_user': 'ignored', # FIXME: We need a staging cache set up |
163 | 'cc.staging_upload_password': 'ignored', |
164 | 'cc.db_encryption_key': data['db_encryption_key'], |
165 | @@ -439,7 +490,7 @@ |
166 | |
167 | class RouterRelation(RelationContext): |
168 | name = 'router' |
169 | - interface = 'http' |
170 | + interface = 'router' |
171 | required_keys = ['address'] |
172 | port = 8000 |
173 | varz_port = 8084 # not currently used |
174 | @@ -545,6 +596,8 @@ |
175 | 'app_domains': [d['domain'] for d in self[self.name]], |
176 | 'system_domain': domain, # TODO: These should probably be config options |
177 | 'system_domain_organization': 'juju-org', |
178 | + 'logger_endpoint.use_ssl': False, # TODO: support SSL option |
179 | + 'logger_endpoint.port': 80, # default is 443 |
180 | } |
181 | |
182 | |
183 | |
184 | === modified file 'cloudfoundry/releases.py' |
185 | --- cloudfoundry/releases.py 2014-11-05 18:22:07 +0000 |
186 | +++ cloudfoundry/releases.py 2014-12-10 15:53:53 +0000 |
187 | @@ -8,8 +8,6 @@ |
188 | ('uaa-v1', 'uaa'), |
189 | ('login-v1', 'login'), |
190 | ('nats-stream-forwarder-v1', 'nats-sf'), |
191 | - ('loggregator-v1', 'loggregator'), |
192 | - ('hm9000-v1', 'hm'), |
193 | ('haproxy-v1', 'haproxy'), |
194 | ('collector-v1', 'collector'), |
195 | |
196 | @@ -25,7 +23,6 @@ |
197 | ('mysql:db', 'cc:db'), |
198 | ('mysql:db', 'uaa:db'), |
199 | ('etcd:client', 'hm:etcd'), |
200 | - ('etcd:client', 'loggregator:etcd'), |
201 | ('etcd:client', 'loggregator-trafficcontrol:etcd'), |
202 | ] |
203 | |
204 | @@ -34,6 +31,38 @@ |
205 | |
206 | RELEASES = [ |
207 | { |
208 | + "releases": (190, 190), |
209 | + "topology": { |
210 | + "services": COMMON_SERVICES + [ |
211 | + ('router-v3', 'router'), |
212 | + ('cloud-controller-v3', 'cc'), |
213 | + ('cloud-controller-clock-v3', 'cc-clock'), |
214 | + ('cloud-controller-worker-v3', 'cc-worker'), |
215 | + ('dea-v3', 'dea'), |
216 | + ('loggregator-trafficcontroller-v3', 'loggregator-trafficcontrol'), |
217 | + ('hm9000-v2', 'hm'), |
218 | + ('doppler-v1', 'doppler'), |
219 | + ], |
220 | + "relations": COMMON_RELATIONS + [ |
221 | + ('etcd:client', 'cc:etcd'), |
222 | + ('etcd:client', 'cc-worker:etcd'), |
223 | + ('etcd:client', 'cc-clock:etcd'), |
224 | + ('etcd:client', 'router:etcd'), |
225 | + ('etcd:client', 'dea:etcd'), |
226 | + ('etcd:client', 'doppler:etcd'), |
227 | + ], |
228 | + "expose": ['haproxy'], |
229 | + "constraints": { |
230 | + "__default__": "arch=amd64 instance-type=m3.medium", |
231 | + "cc": "arch=amd64 root-disk=12G mem=12G", |
232 | + "cc-worker": "arch=amd64 root-disk=10G", |
233 | + "cc-clock": "arch=amd64 root-disk=10G", |
234 | + "dea": "arch=amd64 mem=5G", |
235 | + }, |
236 | + }, |
237 | + "upgrades": COMMON_UPGRADES |
238 | + }, |
239 | + { |
240 | "releases": (177, 180), |
241 | "topology": { |
242 | "services": COMMON_SERVICES + [ |
243 | @@ -42,7 +71,9 @@ |
244 | ('cloud-controller-clock-v2', 'cc-clock'), |
245 | ('cloud-controller-worker-v2', 'cc-worker'), |
246 | ('dea-v2', 'dea'), |
247 | + ('loggregator-v1', 'loggregator'), |
248 | ('loggregator-trafficcontroller-v2', 'loggregator-trafficcontrol'), |
249 | + ('hm9000-v1', 'hm'), |
250 | ], |
251 | "relations": COMMON_RELATIONS + [ |
252 | ('etcd:client', 'cc:etcd'), |
253 | @@ -50,6 +81,7 @@ |
254 | ('etcd:client', 'cc-clock:etcd'), |
255 | ('etcd:client', 'router:etcd'), |
256 | ('etcd:client', 'dea:etcd'), |
257 | + ('etcd:client', 'loggregator:etcd'), |
258 | ], |
259 | "expose": ['haproxy'], |
260 | "constraints": { |
261 | @@ -71,9 +103,13 @@ |
262 | ('cloud-controller-clock-v1', 'cc-clock'), |
263 | ('cloud-controller-worker-v1', 'cc-worker'), |
264 | ('dea-v1', 'dea'), |
265 | + ('loggregator-v1', 'loggregator'), |
266 | ('loggregator-trafficcontroller-v1', 'loggregator-trafficcontrol'), |
267 | - ], |
268 | - "relations": COMMON_RELATIONS, |
269 | + ('hm9000-v1', 'hm'), |
270 | + ], |
271 | + "relations": COMMON_RELATIONS + [ |
272 | + ('etcd:client', 'loggregator:etcd'), |
273 | + ], |
274 | "expose": ['haproxy'], |
275 | "constraints": { |
276 | "__default__": "arch=amd64", |
277 | |
278 | === modified file 'cloudfoundry/services.py' |
279 | --- cloudfoundry/services.py 2014-11-07 21:18:42 +0000 |
280 | +++ cloudfoundry/services.py 2014-12-10 15:53:53 +0000 |
281 | @@ -49,6 +49,27 @@ |
282 | |
283 | }, |
284 | |
285 | + 'cloud-controller-clock-v3': { |
286 | + 'summary': "A shared clock", |
287 | + 'description': '', |
288 | + 'jobs': [ |
289 | + {'job_name': 'cloud_controller_clock', |
290 | + 'mapping': {'ccdb': mapper.ccdb}, |
291 | + 'provided_data': [], |
292 | + 'required_data': [contexts.NatsRelation, |
293 | + contexts.CloudControllerRelation, |
294 | + contexts.UAARelation, |
295 | + contexts.CloudControllerDBRelation], |
296 | + }, |
297 | + {'job_name': 'metron_agent', |
298 | + 'required_data': [contexts.LTCRelation, |
299 | + contexts.NatsRelation, |
300 | + contexts.DopplerRelation, |
301 | + contexts.EtcdRelation]}, |
302 | + ], |
303 | + |
304 | + }, |
305 | + |
306 | 'cloud-controller-v1': { |
307 | 'summary': 'CF Cloud Controller, the brains of the operation', |
308 | 'description': '', |
309 | @@ -89,6 +110,29 @@ |
310 | ] |
311 | }, |
312 | |
313 | + 'cloud-controller-v3': { |
314 | + 'summary': 'CF Cloud Controller, the brains of the operation', |
315 | + 'description': '', |
316 | + 'jobs': [ |
317 | + {'job_name': 'cloud_controller_ng', |
318 | + 'mapping': {'db': mapper.ccdb}, |
319 | + 'provided_data': [contexts.CloudControllerRelation, |
320 | + contexts.CloudControllerDBRelation], |
321 | + 'required_data': [contexts.NatsRelation, |
322 | + contexts.MysqlRelation, |
323 | + contexts.UAARelation, |
324 | + contexts.DEARelation, |
325 | + contexts.CloudControllerRelation.remote_view, |
326 | + ], |
327 | + }, |
328 | + {'job_name': 'metron_agent', |
329 | + 'required_data': [contexts.LTCRelation, |
330 | + contexts.NatsRelation, |
331 | + contexts.DopplerRelation, |
332 | + contexts.EtcdRelation]}, |
333 | + ] |
334 | + }, |
335 | + |
336 | 'cloud-controller-worker-v1': { |
337 | 'summary': "Worker for cc", |
338 | 'description': '', |
339 | @@ -128,6 +172,27 @@ |
340 | ] |
341 | }, |
342 | |
343 | + 'cloud-controller-worker-v3': { |
344 | + 'summary': "Worker for cc", |
345 | + 'description': '', |
346 | + 'jobs': [ |
347 | + {'job_name': 'cloud_controller_worker', |
348 | + 'mapping': {'ccdb': mapper.ccdb}, |
349 | + 'provided_data': [], |
350 | + 'required_data': [contexts.NatsRelation, |
351 | + contexts.UAARelation, |
352 | + contexts.CloudControllerRelation, |
353 | + contexts.CloudControllerDBRelation, |
354 | + ], |
355 | + }, |
356 | + {'job_name': 'metron_agent', |
357 | + 'required_data': [contexts.LTCRelation, |
358 | + contexts.NatsRelation, |
359 | + contexts.DopplerRelation, |
360 | + contexts.EtcdRelation]}, |
361 | + ] |
362 | + }, |
363 | + |
364 | 'dea-v1': { |
365 | 'summary': 'DEA runs CF apps in containers', |
366 | 'description': '', |
367 | @@ -199,6 +264,47 @@ |
368 | |
369 | }, |
370 | |
371 | + |
372 | + 'dea-v3': { |
373 | + 'summary': 'DEA runs CF apps in containers', |
374 | + 'description': '', |
375 | + 'jobs': [ |
376 | + { |
377 | + 'job_name': 'dea_next', |
378 | + 'mapping': {}, |
379 | + 'install': [ |
380 | + utils.install_linux_image_extra, |
381 | + utils.apt_install(['quota']), |
382 | + utils.modprobe(['quota_v1', 'quota_v2']) |
383 | + ], |
384 | + 'provided_data': [contexts.DEARelation], |
385 | + 'required_data': [ |
386 | + contexts.NatsRelation, |
387 | + contexts.LTCRelation, |
388 | + contexts.DEARelation.remote_view, |
389 | + contexts.RouterRelation, |
390 | + ], |
391 | + 'data_ready': [ |
392 | + #tasks.enable_swapaccounting |
393 | + tasks.patch_dea |
394 | + ] |
395 | + }, |
396 | + { |
397 | + 'job_name': 'dea_logging_agent', |
398 | + 'mapping': {}, |
399 | + 'required_data': [contexts.NatsRelation, |
400 | + contexts.LTCRelation, |
401 | + contexts.EtcdRelation] |
402 | + }, |
403 | + {'job_name': 'metron_agent', |
404 | + 'required_data': [contexts.LTCRelation, |
405 | + contexts.NatsRelation, |
406 | + contexts.DopplerRelation, |
407 | + contexts.EtcdRelation]}, |
408 | + ] |
409 | + |
410 | + }, |
411 | + |
412 | 'nats-v1': { |
413 | 'service': 'nats', |
414 | 'summary': 'NATS message bus for CF', |
415 | @@ -259,6 +365,25 @@ |
416 | |
417 | }, |
418 | |
419 | + 'router-v3': { |
420 | + 'service': 'router', |
421 | + 'summary': 'CF Router', |
422 | + 'jobs': [ |
423 | + {'job_name': 'gorouter', |
424 | + 'ports': [contexts.RouterRelation.port], |
425 | + 'mapping': {}, |
426 | + 'provided_data': [contexts.RouterRelation], |
427 | + 'required_data': [contexts.NatsRelation, |
428 | + contexts.RouterRelation.remote_view]}, |
429 | + {'job_name': 'metron_agent', |
430 | + 'required_data': [contexts.LTCRelation, |
431 | + contexts.NatsRelation, |
432 | + contexts.DopplerRelation, |
433 | + contexts.EtcdRelation]}, |
434 | + ], |
435 | + |
436 | + }, |
437 | + |
438 | 'uaa-v1': { |
439 | 'service': 'uaa', |
440 | 'summary': 'CF Oauth2 for identity management service', |
441 | @@ -303,6 +428,21 @@ |
442 | }] |
443 | }, |
444 | |
445 | + 'doppler-v1': { |
446 | + 'service': 'doppler', |
447 | + 'summary': 'successor of loggregator', |
448 | + 'description': 'Successor of loggregator.', |
449 | + 'jobs': [{ |
450 | + 'job_name': 'doppler', |
451 | + 'mapping': {}, |
452 | + 'provided_data': [contexts.DopplerRelation], |
453 | + 'required_data': [contexts.NatsRelation, |
454 | + contexts.EtcdRelation, |
455 | + contexts.LTCRelation, |
456 | + contexts.DopplerRelation.remote_view] |
457 | + }] |
458 | + }, |
459 | + |
460 | 'loggregator-trafficcontroller-v1': { |
461 | 'service': 'loggregator-trafficcontroller', |
462 | 'summary': 'loggregator-trafficcontroller', |
463 | @@ -337,6 +477,23 @@ |
464 | ] |
465 | }, |
466 | |
467 | + 'loggregator-trafficcontroller-v3': { |
468 | + 'service': 'loggregator-trafficcontroller', |
469 | + 'summary': 'loggregator-trafficcontroller', |
470 | + 'description': '', |
471 | + 'jobs': [ |
472 | + {'job_name': 'loggregator_trafficcontroller', |
473 | + 'ports': [contexts.LTCRelation.outgoing_port], |
474 | + 'mapping': {}, |
475 | + 'provided_data': [contexts.LTCRelation], |
476 | + 'required_data': [contexts.DopplerRelation, |
477 | + contexts.LTCRelation.remote_view, |
478 | + contexts.NatsRelation, |
479 | + contexts.CloudControllerRelation, |
480 | + contexts.EtcdRelation]}, |
481 | + ] |
482 | + }, |
483 | + |
484 | 'hm9000-v1': { |
485 | 'service': 'hm9000', |
486 | 'summary': 'health monitor', |
487 | @@ -351,6 +508,21 @@ |
488 | }] |
489 | }, |
490 | |
491 | + 'hm9000-v2': { |
492 | + 'service': 'hm9000', |
493 | + 'summary': 'health monitor', |
494 | + 'description': '', |
495 | + 'jobs': [{ |
496 | + 'job_name': 'hm9000', |
497 | + 'mapping': {}, |
498 | + 'provided_data': [], |
499 | + 'required_data': [contexts.NatsRelation, |
500 | + contexts.CloudControllerRelation, |
501 | + contexts.EtcdRelation, |
502 | + contexts.DEARelation] |
503 | + }] |
504 | + }, |
505 | + |
506 | 'haproxy-v1': { |
507 | 'service': 'haproxy', |
508 | 'summary': 'loadbalance the routers', |
509 | |
510 | === modified file 'cloudfoundry/utils.py' |
511 | --- cloudfoundry/utils.py 2014-12-03 23:14:23 +0000 |
512 | +++ cloudfoundry/utils.py 2014-12-10 15:53:53 +0000 |
513 | @@ -23,8 +23,10 @@ |
514 | |
515 | |
516 | @contextmanager |
517 | -def cd(directory): |
518 | +def cd(directory, make=False): |
519 | cwd = os.getcwd() |
520 | + if not os.path.exists(directory) and make: |
521 | + os.makedirs(directory) |
522 | os.chdir(directory) |
523 | try: |
524 | yield |
525 | |
526 | === modified file 'reconciler/app.py' |
527 | --- reconciler/app.py 2014-11-20 16:09:27 +0000 |
528 | +++ reconciler/app.py 2014-12-10 15:53:53 +0000 |
529 | @@ -135,6 +135,8 @@ |
530 | service['health'] = 'warn' |
531 | else: |
532 | service['health'] = 'pass' |
533 | + if service_name == 'cloudfoundry' and db.error: # XXX don't hard-code |
534 | + service['health'] = 'fail' |
535 | |
536 | |
537 | def get_current_state(): |
538 | |
539 | === modified file 'reconciler/strategy.py' |
540 | --- reconciler/strategy.py 2014-11-11 18:22:53 +0000 |
541 | +++ reconciler/strategy.py 2014-12-10 15:53:53 +0000 |
542 | @@ -28,6 +28,7 @@ |
543 | self.strategy = Strategy(self.env) |
544 | self.history = [] |
545 | self.exec_lock = threading.Lock() |
546 | + self.error = False |
547 | |
548 | def reset(self): |
549 | self.expected = {} |
550 | @@ -106,8 +107,12 @@ |
551 | return [] |
552 | |
553 | # Service Deltas |
554 | - self.strategy.extend(self.build_services()) |
555 | - self.strategy.extend(self.build_relations()) |
556 | + try: |
557 | + self.strategy.extend(self.build_services()) |
558 | + self.strategy.extend(self.build_relations()) |
559 | + except Exception as e: |
560 | + self.error = True |
561 | + logging.error('Error building strategy: %s', e) |
562 | |
563 | def _changed(self): |
564 | previous = hashlib.md5(json.dumps(self.previous or {}, sort_keys=True)) |
565 | @@ -205,6 +210,10 @@ |
566 | self.execute_strategy) |
567 | else: |
568 | self._reset_strategy() |
569 | + self.error = False |
570 | + except Exception as e: |
571 | + self.error = True |
572 | + logging.error('Error executing strategy: %s', e) |
573 | finally: |
574 | self.exec_lock.release() |
575 | |
576 | |
577 | === modified file 'tests/02-cats' |
578 | --- tests/02-cats 2014-10-01 18:50:57 +0000 |
579 | +++ tests/02-cats 2014-12-10 15:53:53 +0000 |
580 | @@ -1,3 +1,3 @@ |
581 | #!/bin/bash |
582 | |
583 | -python tests/cats.py |
584 | +python tests/cats.py "$@" |
585 | |
586 | === modified file 'tests/cats.py' |
587 | --- tests/cats.py 2014-10-16 15:01:08 +0000 |
588 | +++ tests/cats.py 2014-12-10 15:53:53 +0000 |
589 | @@ -6,6 +6,7 @@ |
590 | import subprocess |
591 | import sys |
592 | import tempfile |
593 | +from functools import partial |
594 | |
595 | from cloudfoundry.releases import RELEASES |
596 | from cloudfoundry.utils import (api, |
597 | @@ -26,6 +27,7 @@ |
598 | global options |
599 | parser = argparse.ArgumentParser() |
600 | parser.add_argument('-v', '--version', default="latest") |
601 | + parser.add_argument('admin_password', default="password", nargs='?') |
602 | options = parser.parse_args() |
603 | if options.version == 'latest': |
604 | options.version = RELEASES[0]['releases'][1] |
605 | @@ -50,10 +52,11 @@ |
606 | |
607 | def get_cats(version): |
608 | logging.info("Getting CATs from github") |
609 | - if not os.path.exists('cf-acceptance-tests'): |
610 | - sh.git('clone', |
611 | - 'https://github.com/cloudfoundry/cf-acceptance-tests.git') |
612 | - with cd('cf-acceptance-tests'): |
613 | + if not os.path.exists('src/github.com/cloudfoundry/cf-acceptance-tests'): |
614 | + with cd('src/github.com/cloudfoundry', make=True): |
615 | + sh.git('clone', |
616 | + 'https://github.com/cloudfoundry/cf-acceptance-tests.git') |
617 | + with cd('src/github.com/cloudfoundry/cf-acceptance-tests'): |
618 | sh.git('fetch') |
619 | sh.check('./bin/compile') |
620 | # Switch to the branch of the revision in question |
621 | @@ -66,12 +69,13 @@ |
622 | sha = acceptance[0]['sha'] |
623 | print "Switching CATs to {} to test version {}".format( |
624 | sha[:6], version) |
625 | - sh.git('reset', '--hard', sha) |
626 | - |
627 | - |
628 | -def run_cats(): |
629 | + sh.git('checkout', sha) |
630 | + |
631 | + |
632 | +def run_cats(options): |
633 | ep = endpoint() |
634 | - with cd('cf-acceptance-tests'): |
635 | + gopath = os.getcwd() |
636 | + with cd('src/github.com/cloudfoundry/cf-acceptance-tests'): |
637 | fd, fn = tempfile.mkstemp(suffix=".json") |
638 | os.close(fd) |
639 | with open(fn, 'w') as fp: |
640 | @@ -81,8 +85,8 @@ |
641 | "api": api(), |
642 | "syslog_drain_port": 8082, |
643 | "syslog_ip_address": ep, |
644 | - "password": "admin", |
645 | - "admin_password": "admin", |
646 | + "password": options.admin_password, |
647 | + "admin_password": options.admin_password, |
648 | "user": "admin", |
649 | "admin_user": "admin", |
650 | "org": "juju-org", |
651 | @@ -94,7 +98,10 @@ |
652 | json.dump(defaults, fp, indent=2, sort_keys=True) |
653 | logging.info("Running CATs %s", defaults) |
654 | env = os.environ.copy() |
655 | - env.update({'CONFIG': os.path.abspath(fn)}) |
656 | + env.update({ |
657 | + 'CONFIG': os.path.abspath(fn), |
658 | + 'GOPATH': gopath, |
659 | + }) |
660 | subprocess.call('./bin/test', shell=True, env=env) |
661 | |
662 | |
663 | @@ -103,9 +110,11 @@ |
664 | logging.basicConfig(level=logging.INFO) |
665 | get_cats(options.version) |
666 | bootstrap() |
667 | - deploy() |
668 | - wait_for(60 * 40, 30, cf_service, endpoint, login) |
669 | - run_cats() |
670 | + deploy(generate_dependents=True, |
671 | + admin_password=options.admin_password) |
672 | + wait_for(60 * 40, 30, |
673 | + cf_service, endpoint, partial(login, options.admin_password)) |
674 | + run_cats(options) |
675 | sys.exit(0) |
676 | |
677 |
These changes LGTM. Its nice that you found the dangling reference issue with placement and the clean up on interface types, like http->login.
I'd like to hold off landing this until we've identified the remaining issue with CATs, even if we can't fix that one remaining test run today I'd like some clarity as to why. If it works on a fresh run this morning its most likely a GC issue and we'll need to address that separately.
Thanks