Merge lp:~verterok/charms/trusty/logstash-forwarder/fix-deps-in-all-3-deploy into lp:~canonical-is-sa/charms/trusty/logstash-forwarder/trunk

Proposed by Guillermo Gonzalez
Status: Merged
Merged at revision: 20
Proposed branch: lp:~verterok/charms/trusty/logstash-forwarder/fix-deps-in-all-3-deploy
Merge into: lp:~canonical-is-sa/charms/trusty/logstash-forwarder/trunk
Diff against target: 39 lines (+21/-1)
2 files modified
hooks/hooks.py (+1/-1)
hooks/install (+20/-0)
To merge this branch: bzr merge lp:~verterok/charms/trusty/logstash-forwarder/fix-deps-in-all-3-deploy
Reviewer Review Type Date Requested Status
Laurent Sesquès Approve
Review via email: mp+319692@code.launchpad.net

Commit message

Fix install in Ubuntu versions without py2 installed, where the service didn't installed python-yaml nor python-cheetah

Description of the change

Fix install in Ubuntu versions without py2 installed, where the service didn't installed python-yaml nor python-cheetah, e.g: xenial + py3 charm deployed

To post a comment you must log in.
19. By Guillermo Gonzalez

make install executable

20. By Guillermo Gonzalez

register install.real instead of install

Revision history for this message
Laurent Sesquès (sajoupa) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/hooks.py'
2--- hooks/hooks.py 2017-03-07 10:46:24 +0000
3+++ hooks/hooks.py 2017-03-13 19:02:13 +0000
4@@ -210,7 +210,7 @@
5 os.chmod(dest, 0755)
6
7
8-@hooks.hook("install")
9+@hooks.hook("install.real")
10 def install():
11 log("CHARM: Installing {}".format(conf.appName()))
12 installPackages()
13
14=== added file 'hooks/install'
15--- hooks/install 1970-01-01 00:00:00 +0000
16+++ hooks/install 2017-03-13 19:02:13 +0000
17@@ -0,0 +1,20 @@
18+#!/bin/bash
19+# Wrapper to deal with newer Ubuntu versions that don't have py2 installed
20+# by default.
21+
22+declare -a DEPS=('yaml' 'cheetah')
23+
24+check_and_install() {
25+ pkg="${1}-${2}"
26+ if ! dpkg -s ${pkg} 2>&1 > /dev/null; then
27+ apt-get -y install ${pkg}
28+ fi
29+}
30+
31+PYTHON="python"
32+
33+for dep in ${DEPS[@]}; do
34+ check_and_install ${PYTHON} ${dep}
35+done
36+
37+exec ./hooks/install.real
38
39=== renamed symlink 'hooks/install' => 'hooks/install.real'

Subscribers

People subscribed via source and target branches