Merge lp:~psivaa/charms/trusty/jenkaas/install-plugins into lp:~canonical-ci-engineering/charms/trusty/jenkaas/trunk

Proposed by Para Siva
Status: Merged
Approved by: Para Siva
Approved revision: 13
Merged at revision: 4
Proposed branch: lp:~psivaa/charms/trusty/jenkaas/install-plugins
Merge into: lp:~canonical-ci-engineering/charms/trusty/jenkaas/trunk
Prerequisite: lp:~psivaa/charms/trusty/jenkaas/install-jenkins
Diff against target: 59 lines (+19/-9)
2 files modified
hooks/actions.py (+18/-8)
hooks/services.py (+1/-1)
To merge this branch: bzr merge lp:~psivaa/charms/trusty/jenkaas/install-plugins
Reviewer Review Type Date Requested Status
Joe Talbott (community) Approve
Francis Ginther Approve
Review via email: mp+261841@code.launchpad.net

Commit message

Installing jenkins plugins copied to charm/files/plugins by the spec

Description of the change

Installing jenkins plugins copied to charm/files/plugins by the spec

To post a comment you must log in.
Revision history for this message
Francis Ginther (fginther) wrote :

I agree that we'll need to install the plugins by passing them along inside the charm payload. But I think we're better off actually coping them to /var/lib/jenkins/plugins and making sure they are owned by "jenkins:jenkins".

review: Needs Fixing
7. By Para Siva

Merging install jenkins

8. By Para Siva

pyflakes and pep8

9. By Para Siva

Copying instead of symlinking

10. By Para Siva

pep8 and pyflakes

11. By Para Siva

Set the ownership to the right plugins

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

Thanks Francis for the review and the informal review :). I think I've addressed your concerns. Would appreciate a re-review.

12. By Para Siva

Remove config file setup

13. By Para Siva

pyflakes

Revision history for this message
Francis Ginther (fginther) wrote :

Looks good.

review: Approve
Revision history for this message
Joe Talbott (joetalbott) wrote :

This looks good to me. One minor comment inline regarding os.path.exists()/mkdir() combination.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'files/plugins'
=== modified file 'hooks/actions.py'
--- hooks/actions.py 2015-06-16 08:34:49 +0000
+++ hooks/actions.py 2015-06-16 15:39:50 +0000
@@ -1,9 +1,13 @@
1import base641import glob
2import grp
2import os3import os
4import pwd
5import shutil
3import subprocess6import subprocess
47
5from charmhelpers import fetch8from charmhelpers import fetch
6from charmhelpers.core import hookenv9from charmhelpers.core import hookenv
10from charmhelpers.core.host import mkdir
7from charmhelpers.payload import execd11from charmhelpers.payload import execd
812
9SERVICE_NAME = 'jenkaas'13SERVICE_NAME = 'jenkaas'
@@ -31,13 +35,19 @@
31 subprocess.check_call(['dpkg', '-i', jenkins_deb])35 subprocess.check_call(['dpkg', '-i', jenkins_deb])
3236
3337
34def update_config_file(service_name):38def install_plugins(service_name):
35 hookenv.log(39 hookenv.log('Installing plugins')
36 'Updating service configuration file: %s', SERVICE_CONFIGNAME)40 charm_plugins_dir = os.path.join(hookenv.charm_dir(), 'files/plugins')
37 config_content = base64.b64decode(config['config-file'])41 plugins = glob.glob(os.path.join(charm_plugins_dir, '*.hpi'))
38 config_path = os.path.join(_service_dir(), SERVICE_CONFIGNAME)42 service_plugin_dir = os.path.join(_service_dir(), 'plugins')
39 with open(config_path, 'w') as f:43 if not os.path.exists(service_plugin_dir):
40 f.write(config_content)44 mkdir(service_plugin_dir, 'jenkins', 'jenkins', 0o755)
45 uid = pwd.getpwnam("jenkins").pw_uid
46 gid = grp.getgrnam("jenkins").gr_gid
47 for plugin in plugins:
48 shutil.copy2(plugin, service_plugin_dir)
49 os.chown(os.path.join(service_plugin_dir, os.path.basename(plugin)),
50 uid, gid)
4151
4252
43def install_jenkins_dep_pkges(service_name):53def install_jenkins_dep_pkges(service_name):
4454
=== modified file 'hooks/services.py'
--- hooks/services.py 2015-06-16 08:11:39 +0000
+++ hooks/services.py 2015-06-16 15:39:50 +0000
@@ -15,7 +15,7 @@
15 actions.basenode,15 actions.basenode,
16 actions.install_jenkins_dep_pkges,16 actions.install_jenkins_dep_pkges,
17 actions.install_jenkins,17 actions.install_jenkins,
18 actions.update_config_file,18 actions.install_plugins,
19 helpers.render_template(19 helpers.render_template(
20 source='upstart.conf',20 source='upstart.conf',
21 target='/etc/init/jenkaas.conf'),21 target='/etc/init/jenkaas.conf'),

Subscribers

People subscribed via source and target branches