Merge lp:~cprov/charms/trusty/adt-cloud-service/bug-1409763 into lp:~canonical-ci-engineering/charms/trusty/adt-cloud-service/trunk

Proposed by Celso Providelo
Status: Merged
Approved by: Celso Providelo
Approved revision: 3
Merged at revision: 3
Proposed branch: lp:~cprov/charms/trusty/adt-cloud-service/bug-1409763
Merge into: lp:~canonical-ci-engineering/charms/trusty/adt-cloud-service/trunk
Diff against target: 44 lines (+16/-7)
2 files modified
hooks/actions.py (+15/-7)
hooks/services.py (+1/-0)
To merge this branch: bzr merge lp:~cprov/charms/trusty/adt-cloud-service/bug-1409763
Reviewer Review Type Date Requested Status
Francis Ginther Approve
Thomi Richards (community) Approve
Review via email: mp+253124@code.launchpad.net

Commit message

Implement a service action for blindly setting existing website relation data because RelationContext.provide_data() is not being properly called. See bug #1409763 for more info.

Description of the change

Implement a service action for blindly setting existing website relation data because RelationContext.provide_data() is not being properly called. See bug #1409763 for more info.

The side-effect of doing it is that our mojo spec manifest will have to deploy services, deploy relations and then deploy services again (so the action will be triggered when there is already an established relation) ... odd, but will work until the before mentioned bug gets fixed on charmhelpers.

That's what we get for using cutting-edge nice features :-(

To post a comment you must log in.
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

LGTM

review: Approve
Revision history for this message
Francis Ginther (fginther) wrote :

approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/actions.py'
2--- hooks/actions.py 2015-03-13 02:42:53 +0000
3+++ hooks/actions.py 2015-03-16 21:58:42 +0000
4@@ -78,13 +78,21 @@
5 host.mkdir(LOG_DIR, WSGI_USER, WSGI_GROUP, perms=0755)
6
7
8-class WebsiteRelation(helpers.RelationContext):
9- name = 'website'
10- interface = 'http'
11+def publish_website_relation_data(service_name):
12+ # Due to Bug #1409763, this functionality is as action rather than the
13+ # provided_data below.
14+ for relid in hookenv.relation_ids('website'):
15+ hookenv.log(30 * '*')
16+ hookenv.log('Hack for #1409763: {}'.format(relid))
17+ hookenv.log(30 * '*')
18+ hookenv.relation_set(
19+ relid, host=hookenv.unit_get('private-address'), port=8000)
20+
21+
22+class WebsiteRelation(helpers.HttpRelation):
23
24 def provide_data(self):
25- data = {
26- 'hostname': hookenv.unit_private_ip(),
27- 'port': 8000,
28- }
29+ hookenv.log('Providing Website relation data.')
30+ data = super(WebsiteRelation, self).provide_data()
31+ data['port'] = 8000
32 return data
33
34=== modified file 'hooks/services.py'
35--- hooks/services.py 2015-03-13 02:42:53 +0000
36+++ hooks/services.py 2015-03-16 21:58:42 +0000
37@@ -23,6 +23,7 @@
38 helpers.render_template(
39 source='upstart.conf',
40 target='/etc/init/adt-cloud-service.conf'),
41+ actions.publish_website_relation_data,
42 actions.log_start,
43 ],
44 },

Subscribers

People subscribed via source and target branches