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

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

Commit message

Add relationship hooks for handling the jenkaas-slave relationship.

Description of the change

Add relationship hooks and boilerplate for handling the jenkaas-slave relationship.

This doesn't do anything useful yet, just accepts the relationship from a jenkaas-slave. install_slaves() will report:

{'jenkaas-slave': {u'jenkaas-slave:0': {'jenkaas/0': {u'private-address': u'10.25.176.81', u'master-address': u'10.25.176.81', u'port': u'48484'}, u'jenkaas-slave/0': {u'private-address': u'10.25.176.82', u'slave-address': u'10.25.176.82'}}}}

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-16 15:39:39 +0000
+++ hooks/actions.py 2015-06-17 13:51:03 +0000
@@ -54,3 +54,8 @@
54 hookenv.log('Installing dependency packages')54 hookenv.log('Installing dependency packages')
55 fetch.apt_update()55 fetch.apt_update()
56 fetch.apt_install(DEPS_PKGES, options=['--fix-broken', ], fatal=True)56 fetch.apt_install(DEPS_PKGES, options=['--fix-broken', ], fatal=True)
57
58
59def install_slaves(service_name):
60 hookenv.log('Installing slaves')
61 hookenv.log(hookenv.relations())
5762
=== 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-16 15:38:14 +0000
+++ hooks/services.py 2015-06-17 13:51:03 +0000
@@ -1,26 +1,46 @@
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 import helpers3from charmhelpers.core.services.helpers import (
4 RelationContext,
5 render_template,
6)
47
5import actions8import actions
69
710
11class MasterToSlaveProvider(RelationContext):
12 """Provide data on the jenkaas-slave relationship."""
13 name = 'jenkaas-slave'
14 interface = 'jenkaas-slave'
15
16 def provide_data(self):
17 return {
18 'master-address': hookenv.unit_get('private-address'),
19 'port': 48484,
20 }
21
22
8def manage():23def manage():
9 config = hookenv.config()24 config = hookenv.config()
10 manager = ServiceManager([25 manager = ServiceManager([
11 {26 {
12 'service': 'jenkaas',27 'service': 'jenkaas',
13 'required_data': [config],28 'required_data': [
29 config,
30 ],
31 'provided_data': [MasterToSlaveProvider()],
14 'data_ready': [32 'data_ready': [
15 actions.basenode,33 actions.basenode,
16 actions.install_jenkins_dep_pkges,34 actions.install_jenkins_dep_pkges,
17 actions.install_jenkins,35 actions.install_jenkins,
18 actions.install_plugins,36 actions.install_plugins,
19 helpers.render_template(37 render_template(
20 source='upstart.conf',38 source='upstart.conf',
21 target='/etc/init/jenkaas.conf'),39 target='/etc/init/jenkaas.conf'),
40 actions.install_slaves,
22 actions.log_start,41 actions.log_start,
23 ],42 ],
43 'ports': [48484],
24 },44 },
25 ])45 ])
26 manager.manage()46 manager.manage()
2747
=== modified file 'metadata.yaml'
--- metadata.yaml 2015-06-15 18:17:25 +0000
+++ metadata.yaml 2015-06-17 13:51:03 +0000
@@ -4,3 +4,6 @@
4maintainer: 4maintainer:
5description: |5description: |
6 Runs jenkins server from a given service tarball (provided as files/jenkaas.tgz).6 Runs jenkins server from a given service tarball (provided as files/jenkaas.tgz).
7provides:
8 jenkaas-slave:
9 interface: jenkaas-slave

Subscribers

People subscribed via source and target branches