Add install_deps to ensure python dependencies are installed

Change-Id: I02d3954bfc607a4520e490913e4ad3001deec55b
This commit is contained in:
Chris MacNaughton 2016-12-01 13:46:11 -05:00
parent 0b308732e4
commit 15e6c17a72
3 changed files with 20 additions and 0 deletions

View File

@ -17,4 +17,5 @@ for dep in ${DEPS[@]}; do
check_and_install ${PYTHON} ${dep}
done
./hooks/install_deps
exec ./hooks/install.real

18
hooks/install_deps Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
# Wrapper to ensure that python dependencies are installed before we get into
# the python part of the hook execution
declare -a DEPS=('dnspython' 'pyudev')
check_and_install() {
pkg="${1}-${2}"
if ! dpkg -s ${pkg} 2>&1 > /dev/null; then
apt-get -y install ${pkg}
fi
}
PYTHON="python"
for dep in ${DEPS[@]}; do
check_and_install ${PYTHON} ${dep}
done

View File

@ -3,4 +3,5 @@
# after we upgrade the charm with newer libraries
rm -rf **/*.pyc
./hooks/install_deps
exec ./hooks/upgrade-charm.real