Merge lp:~james-page/charms/precise/jenkins-slave/fixup into lp:charms/jenkins-slave

Proposed by James Page
Status: Merged
Approved by: Juan L. Negron
Approved revision: 18
Merged at revision: 10
Proposed branch: lp:~james-page/charms/precise/jenkins-slave/fixup
Merge into: lp:charms/jenkins-slave
Diff against target: 107 lines (+24/-26)
6 files modified
CHANGES.md (+0/-11)
hooks/install (+12/-5)
hooks/install.d/README (+7/-0)
hooks/slave-relation-changed (+4/-5)
hooks/slave-relation-departed (+0/-4)
revision (+1/-1)
To merge this branch: bzr merge lp:~james-page/charms/precise/jenkins-slave/fixup
Reviewer Review Type Date Requested Status
Juan L. Negron (community) Approve
Review via email: mp+117433@code.launchpad.net

Description of the change

* FIX: Fixup /etc/default/jenkins-slave configuration handling (changed from
  upstart override).
* FEATURE: Add hooks/install.d to allow charm to be extended.

To post a comment you must log in.
Revision history for this message
Juan L. Negron (negronjl) wrote :

Reviewing this now.

-Juan

Revision history for this message
Juan L. Negron (negronjl) wrote :

Thanks James.

Approved.

-Juan

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'CHANGES.md'
2--- CHANGES.md 2011-10-07 13:43:39 +0000
3+++ CHANGES.md 1970-01-01 00:00:00 +0000
4@@ -1,11 +0,0 @@
5-jenkins-slave 7
6----------------
7-
8-* [james-page] minor refactoring to master-slave setup
9-
10-jenkins-slave 6
11----------------
12-
13-* [james-page] Migrated ensemble-log -> juju-log inline with project renaming
14-* [james-page] Fixup use of ENSEMBLE_REMOTE_UNIT -> JUJU_REMOTE_UNIT
15-* [james-page] str -> string in config.yaml
16
17=== added symlink 'hooks/config-changed'
18=== target is u'install'
19=== modified file 'hooks/install'
20--- hooks/install 2012-04-27 13:25:33 +0000
21+++ hooks/install 2012-07-31 13:54:28 +0000
22@@ -4,10 +4,7 @@
23
24 install_slave () {
25 juju-log "Installing jenkins-slave..."
26- apt-get -y install python-software-properties
27- add-apt-repository ppa:hudson-ubuntu/testing
28- apt-get update || true
29- apt-get -y install -qq jenkins-slave
30+ apt-get -y install -qq jenkins-slave wget
31 }
32 [[ -f /etc/init/jenkins-slave.conf ]] || install_slave
33
34@@ -16,6 +13,16 @@
35 juju-log "Installing tools..."
36 apt-get -y install -qq `config-get tools`
37 }
38-install_tools
39+install_tools
40+
41+# Execute any hook overlay which may be provided
42+# by forks of this charm
43+if [ -d hooks/install.d ]
44+then
45+ for i in `ls -1 hooks/install.d/*`
46+ do
47+ [[ -x $i ]] && . ./$i
48+ done
49+fi
50
51 exit 0
52
53=== added directory 'hooks/install.d'
54=== added file 'hooks/install.d/README'
55--- hooks/install.d/README 1970-01-01 00:00:00 +0000
56+++ hooks/install.d/README 2012-07-31 13:54:28 +0000
57@@ -0,0 +1,7 @@
58+This directory can be used to extend the function
59+of the jenkins master charm without changing any
60+of the base hooks.
61+
62+Files must be executable otherwise the install hook
63+(which is also run on upgrade-charm and config-changed
64+hooks) will not execute them.
65
66=== modified file 'hooks/slave-relation-changed'
67--- hooks/slave-relation-changed 2011-10-07 13:43:39 +0000
68+++ hooks/slave-relation-changed 2012-07-31 13:54:28 +0000
69@@ -12,13 +12,12 @@
70
71 # Set the slave hostname to match the juju unit
72 # in the jenkins master instance
73-slavehost=`echo ${JUJU_UNIT_NAME} | sed s,/,-,`
74+slavehost=`echo ${JUJU_UNIT_NAME} | sed s,/,-,`
75
76 juju-log "Configuring jenkins-slave with $url..."
77-cat > /etc/init/jenkins-slave.override << EOF
78-env JENKINS_URL=$url
79-env JENKINS_HOSTNAME=$slavehost
80-EOF
81+sed -i -e "s!^JENKINS_HOSTNAME.*!JENKINS_HOSTNAME=${slavehost}!" \
82+ -e "s!^#*JENKINS_URL.*!JENKINS_URL=${url}!" \
83+ /etc/default/jenkins-slave
84
85 juju-log "Restarting jenkins-slave..."
86 # Startup the jenkins-slave service
87
88=== modified file 'hooks/slave-relation-departed'
89--- hooks/slave-relation-departed 2011-08-02 08:53:54 +0000
90+++ hooks/slave-relation-departed 2012-07-31 13:54:28 +0000
91@@ -1,7 +1,3 @@
92 #!/bin/bash
93
94 stop jenkins-slave || true
95-
96-if [ -f /etc/init/jenkins-slave.override]; then
97- rm /etc/init/jenkins-slave.override
98-fi
99
100=== added symlink 'hooks/upgrade-charm'
101=== target is u'install'
102=== modified file 'revision'
103--- revision 2011-10-07 13:43:39 +0000
104+++ revision 2012-07-31 13:54:28 +0000
105@@ -1,1 +1,1 @@
106-7
107+8

Subscribers

People subscribed via source and target branches

to all changes: