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
=== modified file 'hooks/hooks.py'
--- hooks/hooks.py 2017-03-07 10:46:24 +0000
+++ hooks/hooks.py 2017-03-13 19:02:13 +0000
@@ -210,7 +210,7 @@
210 os.chmod(dest, 0755)210 os.chmod(dest, 0755)
211211
212212
213@hooks.hook("install")213@hooks.hook("install.real")
214def install():214def install():
215 log("CHARM: Installing {}".format(conf.appName()))215 log("CHARM: Installing {}".format(conf.appName()))
216 installPackages()216 installPackages()
217217
=== added file 'hooks/install'
--- hooks/install 1970-01-01 00:00:00 +0000
+++ hooks/install 2017-03-13 19:02:13 +0000
@@ -0,0 +1,20 @@
1#!/bin/bash
2# Wrapper to deal with newer Ubuntu versions that don't have py2 installed
3# by default.
4
5declare -a DEPS=('yaml' 'cheetah')
6
7check_and_install() {
8 pkg="${1}-${2}"
9 if ! dpkg -s ${pkg} 2>&1 > /dev/null; then
10 apt-get -y install ${pkg}
11 fi
12}
13
14PYTHON="python"
15
16for dep in ${DEPS[@]}; do
17 check_and_install ${PYTHON} ${dep}
18done
19
20exec ./hooks/install.real
021
=== renamed symlink 'hooks/install' => 'hooks/install.real'

Subscribers

People subscribed via source and target branches