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

Proposed by Francis Ginther
Status: Needs review
Proposed branch: lp:~fginther/charms/trusty/jenkaas-slave/update-slave-config
Merge into: lp:~canonical-ci-engineering/charms/trusty/jenkaas-slave/trunk
Diff against target: 46 lines (+14/-2)
2 files modified
hooks/actions.py (+12/-1)
hooks/services.py (+2/-1)
To merge this branch: bzr merge lp:~fginther/charms/trusty/jenkaas-slave/update-slave-config
Reviewer Review Type Date Requested Status
Para Siva (community) Approve
Joe Talbott (community) Approve
Review via email: mp+262619@code.launchpad.net

Commit message

Finish the changes needed to configure a slave via the jenkaas-slave relation.

Description of the change

Finish the changes needed to configure a slave via the jenkaas-slave relation.

This includes passing info on the default user so that the slave can connect without having to enable slave changes via the anonymous user.

To post a comment you must log in.
Revision history for this message
Joe Talbott (joetalbott) wrote :

Looks okay to me.

review: Approve
Revision history for this message
Para Siva (psivaa) wrote :

+1, looks good to me.

review: Approve

Unmerged revisions

8. By Francis Ginther

Fix some errors and add the jenkaas-slave-relation-departed hook.

7. By Francis Ginther

Add passing of -jnlpCredentials and remove 'port'.

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-06-18 18:06:42 +0000
3+++ hooks/actions.py 2015-06-22 18:40:32 +0000
4@@ -48,9 +48,15 @@
5
6 def configure_slave(service_name):
7 hookenv.log('Configuring the slave')
8+ hookenv.log('hook: {}'.format(hookenv.hook_name()))
9+ if not hookenv.in_relation_hook():
10+ return
11+
12 unit_name = hookenv.local_unit().replace('/', '-')
13- master_url = 'http://{}:8080/'.format(
14+ master_url = 'http://{}:8080'.format(
15 hookenv.relation_get('master-address'))
16+ username = hookenv.relation_get('username')
17+ password = hookenv.relation_get('password')
18 hookenv.log('Configuring {} to connect to {}'.format(
19 unit_name, master_url))
20
21@@ -62,6 +68,11 @@
22 line = 'JENKINS_HOSTNAME={}\n'.format(unit_name)
23 if 'JENKINS_URL=' in line:
24 line = 'JENKINS_URL={}\n'.format(master_url)
25+ if 'JENKINS_ARGS=' in line:
26+ line = 'JENKINS_ARGS="-jnlpUrl ' \
27+ '$JENKINS_URL/computer/$JENKINS_HOSTNAME/' \
28+ 'slave-agent.jnlp -jnlpCredentials ' \
29+ '{}:{}"'.format(username, password)
30 out_file.write(line)
31 shutil.move(temp_path, config_path)
32 # Set the file permissions to their original value
33
34=== added symlink 'hooks/jenkaas-slave-relation-departed'
35=== target is u'hooks.py'
36=== modified file 'hooks/services.py'
37--- hooks/services.py 2015-06-18 11:59:55 +0000
38+++ hooks/services.py 2015-06-22 18:40:32 +0000
39@@ -22,7 +22,8 @@
40 interface = 'jenkaas-slave'
41 required_keys = [
42 'master-address',
43- 'port',
44+ 'username',
45+ 'password',
46 ]
47
48

Subscribers

People subscribed via source and target branches