Merge lp:~fginther/charms/trusty/jenkaas-slave/add-relation into lp:~canonical-ci-engineering/charms/trusty/jenkaas-slave/trunk

Proposed by Francis Ginther
Status: Merged
Approved by: Francis Ginther
Approved revision: 9
Merged at revision: 3
Proposed branch: lp:~fginther/charms/trusty/jenkaas-slave/add-relation
Merge into: lp:~canonical-ci-engineering/charms/trusty/jenkaas-slave/trunk
Diff against target: 74 lines (+31/-2)
3 files modified
hooks/actions.py (+1/-1)
hooks/services.py (+27/-1)
metadata.yaml (+3/-0)
To merge this branch: bzr merge lp:~fginther/charms/trusty/jenkaas-slave/add-relation
Reviewer Review Type Date Requested Status
Joe Talbott (community) Approve
Review via email: mp+262220@code.launchpad.net

Commit message

Add relationship hooks for handling the jenkaas-slave relationship.

Description of the change

Add relationship hooks for handling the jenkaas-slave relationship.

This doesn't do anything useful yet, but does force the master-address to be available before any of the data_ready actions are executed.

To post a comment you must log in.
Revision history for this message
Joe Talbott (joetalbott) :
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-06-12 22:40:31 +0000
+++ hooks/actions.py 2015-06-17 13:52:32 +0000
@@ -32,7 +32,7 @@
3232
33def install_service_dependencies(service_name):33def install_service_dependencies(service_name):
34 hookenv.log('Installing service dependencies')34 hookenv.log('Installing service dependencies')
35 fetch.configure_sources(update=True)35 fetch.apt_update(fatal=True)
36 fetch.apt_install(REQUIRED_PACKAGES, fatal=True)36 fetch.apt_install(REQUIRED_PACKAGES, fatal=True)
3737
3838
3939
=== added symlink 'hooks/jenkaas-slave-relation-changed'
=== target is u'hooks.py'
=== added symlink 'hooks/jenkaas-slave-relation-joined'
=== target is u'hooks.py'
=== modified file 'hooks/services.py'
--- hooks/services.py 2015-06-12 22:40:31 +0000
+++ hooks/services.py 2015-06-17 13:52:32 +0000
@@ -1,15 +1,41 @@
1from charmhelpers.core import hookenv1from charmhelpers.core import hookenv
2from charmhelpers.core.services.base import ServiceManager2from charmhelpers.core.services.base import ServiceManager
3from charmhelpers.core.services.helpers import RelationContext
34
4import actions5import actions
56
67
8class SlaveToMasterProvider(RelationContext):
9 """Provide data on the jenkaas-slave relationship."""
10 name = 'jenkaas-slave'
11 interface = 'jenkaas-slave'
12
13 def provide_data(self):
14 return {
15 'slave-address': hookenv.unit_get('private-address'),
16 }
17
18
19class SlaveToMasterConsumer(RelationContext):
20 """Requirements for the jenkaas-slave relationship."""
21 name = 'jenkaas-slave'
22 interface = 'jenkaas-slave'
23 required_keys = [
24 'master-address',
25 'port',
26 ]
27
28
7def manage():29def manage():
8 config = hookenv.config()30 config = hookenv.config()
9 manager = ServiceManager([31 manager = ServiceManager([
10 {32 {
11 'service': 'jenkins-slave',33 'service': 'jenkins-slave',
12 'required_data': [config],34 'required_data': [
35 config,
36 SlaveToMasterConsumer(),
37 ],
38 'provided_data': [SlaveToMasterProvider()],
13 'data_ready': [39 'data_ready': [
14 actions.basenode,40 actions.basenode,
15 actions.install_service_dependencies,41 actions.install_service_dependencies,
1642
=== modified file 'metadata.yaml'
--- metadata.yaml 2015-06-12 22:37:23 +0000
+++ metadata.yaml 2015-06-17 13:52:32 +0000
@@ -6,3 +6,6 @@
6description: |6description: |
7 Installs the jenkins slave package and connects a jenkins master using7 Installs the jenkins slave package and connects a jenkins master using
8 juju relations.8 juju relations.
9requires:
10 jenkaas-slave:
11 interface: jenkaas-slave

Subscribers

People subscribed via source and target branches