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

Proposed by Francis Ginther
Status: Merged
Approved by: Francis Ginther
Approved revision: 2
Merged at revision: 2
Proposed branch: lp:~fginther/charms/trusty/jenkaas-slave/install-jenkins-slave
Merge into: lp:~canonical-ci-engineering/charms/trusty/jenkaas-slave/trunk
Diff against target: 68 lines (+26/-0)
2 files modified
hooks/actions.py (+24/-0)
hooks/services.py (+2/-0)
To merge this branch: bzr merge lp:~fginther/charms/trusty/jenkaas-slave/install-jenkins-slave
Reviewer Review Type Date Requested Status
Joe Talbott (community) Approve
Review via email: mp+261975@code.launchpad.net

Commit message

Add installation of .deb packages and dependencies.

Description of the change

Add installation of .deb packages and dependencies.

The charm is very basic so far, this just adds the installation of the jenkins-slave*.deb files which need to be put in place by the spec.

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:37:23 +0000
+++ hooks/actions.py 2015-06-15 15:02:20 +0000
@@ -1,10 +1,20 @@
1import glob
1import os2import os
3import subprocess
24
5from charmhelpers import fetch
3from charmhelpers.core import hookenv6from charmhelpers.core import hookenv
4from charmhelpers.payload import execd7from charmhelpers.payload import execd
58
6# Keep the same service name that the jenkins-slave package uses.9# Keep the same service name that the jenkins-slave package uses.
7SERVICE_NAME = 'jenkins-slave'10SERVICE_NAME = 'jenkins-slave'
11REQUIRED_PACKAGES = [
12 'adduser',
13 'default-jre-headless',
14 # jenkins-slave requires default-jre-headless | java6-runtime-headless
15 #'java6-runtime-headless',
16 'upstart-job',
17]
818
9config = hookenv.config()19config = hookenv.config()
1020
@@ -20,5 +30,19 @@
20 execd.execd_preinstall()30 execd.execd_preinstall()
2131
2232
33def install_service_dependencies(service_name):
34 hookenv.log('Installing service dependencies')
35 fetch.configure_sources(update=True)
36 fetch.apt_install(REQUIRED_PACKAGES, fatal=True)
37
38
39def install_service_packages(service_name):
40 files_dir = os.path.join(hookenv.charm_dir(), 'files')
41 packages = glob.glob(os.path.join(files_dir, '*.deb'))
42 hookenv.log('Installing service packages: {}'.format(', '.join(packages)))
43 for package in packages:
44 subprocess.check_call(['dpkg', '-i', package])
45
46
23def log_start(service_name):47def log_start(service_name):
24 hookenv.log('Starting service {}'.format(SERVICE_NAME))48 hookenv.log('Starting service {}'.format(SERVICE_NAME))
2549
=== added symlink 'hooks/config-changed'
=== target is u'hooks.py'
=== added symlink 'hooks/install'
=== target is u'hooks.py'
=== modified file 'hooks/services.py'
--- hooks/services.py 2015-06-12 22:37:23 +0000
+++ hooks/services.py 2015-06-15 15:02:20 +0000
@@ -12,6 +12,8 @@
12 'required_data': [config],12 'required_data': [config],
13 'data_ready': [13 'data_ready': [
14 actions.basenode,14 actions.basenode,
15 actions.install_service_dependencies,
16 actions.install_service_packages,
15 actions.log_start,17 actions.log_start,
16 ],18 ],
17 },19 },
1820
=== added symlink 'hooks/start'
=== target is u'hooks.py'
=== added symlink 'hooks/stop'
=== target is u'hooks.py'
=== added symlink 'hooks/upgrade-charm'
=== target is u'hooks.py'

Subscribers

People subscribed via source and target branches