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

Subscribers

People subscribed via source and target branches