Merge lp:~cprov/charms/trusty/adt-image-mapper/bug-1409762 into lp:~canonical-ci-engineering/charms/trusty/adt-image-mapper/trunk

Proposed by Celso Providelo on 2015-03-17
Status: Merged
Approved by: Celso Providelo on 2015-03-17
Approved revision: 2
Merged at revision: 3
Proposed branch: lp:~cprov/charms/trusty/adt-image-mapper/bug-1409762
Merge into: lp:~canonical-ci-engineering/charms/trusty/adt-image-mapper/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-image-mapper/bug-1409762
Reviewer Review Type Date Requested Status
Para Siva (community) 2015-03-17 Approve on 2015-03-17
Review via email: mp+253148@code.launchpad.net

Commit message

Replicating workaround for bug #1409763 (blindly setting website relation via action, since RelationContext.provide_data is not working as expect).

Description of the change

Replicating workaround for bug #1409763 (blindly setting website relation via action, since RelationContext.provide_data is not working as expect).

To post a comment you must log in.
Para Siva (psivaa) wrote :

+1

review: Approve
Para Siva (psivaa) wrote :

(The bug id is bug #1409763 i suppose :))

Celso Providelo (cprov) wrote :

Psivaa,

Yes, got the bug number wrong in several places (branch name, commit message, MP description) ...

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 16:53:41 +0000
3+++ hooks/actions.py 2015-03-17 04:35:31 +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 13:06:46 +0000
36+++ hooks/services.py 2015-03-17 04:35:31 +0000
37@@ -23,6 +23,7 @@
38 helpers.render_template(
39 source='upstart.conf',
40 target='/etc/init/adt-image-mapper.conf'),
41+ actions.publish_website_relation_data,
42 actions.log_start,
43 ],
44 },

Subscribers

People subscribed via source and target branches