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
=== modified file 'hooks/actions.py'
--- hooks/actions.py 2015-03-13 02:42:53 +0000
+++ hooks/actions.py 2015-03-16 21:58:42 +0000
@@ -78,13 +78,21 @@
78 host.mkdir(LOG_DIR, WSGI_USER, WSGI_GROUP, perms=0755)78 host.mkdir(LOG_DIR, WSGI_USER, WSGI_GROUP, perms=0755)
7979
8080
81class WebsiteRelation(helpers.RelationContext):81def publish_website_relation_data(service_name):
82 name = 'website'82 # Due to Bug #1409763, this functionality is as action rather than the
83 interface = 'http'83 # provided_data below.
84 for relid in hookenv.relation_ids('website'):
85 hookenv.log(30 * '*')
86 hookenv.log('Hack for #1409763: {}'.format(relid))
87 hookenv.log(30 * '*')
88 hookenv.relation_set(
89 relid, host=hookenv.unit_get('private-address'), port=8000)
90
91
92class WebsiteRelation(helpers.HttpRelation):
8493
85 def provide_data(self):94 def provide_data(self):
86 data = {95 hookenv.log('Providing Website relation data.')
87 'hostname': hookenv.unit_private_ip(),96 data = super(WebsiteRelation, self).provide_data()
88 'port': 8000,97 data['port'] = 8000
89 }
90 return data98 return data
9199
=== modified file 'hooks/services.py'
--- hooks/services.py 2015-03-13 02:42:53 +0000
+++ hooks/services.py 2015-03-16 21:58:42 +0000
@@ -23,6 +23,7 @@
23 helpers.render_template(23 helpers.render_template(
24 source='upstart.conf',24 source='upstart.conf',
25 target='/etc/init/adt-cloud-service.conf'),25 target='/etc/init/adt-cloud-service.conf'),
26 actions.publish_website_relation_data,
26 actions.log_start,27 actions.log_start,
27 ],28 ],
28 },29 },

Subscribers

People subscribed via source and target branches