charm-ceph-osd/hooks/install
James Page 023b086b0d Fix upgrades from older charm versions
Ensure that netaddr and netifaces are installed on upgrade from
older py2 based charms to the newer py3 based execution.

Change-Id: I1c7b2eb545e5ef5b40ab2db5a1a968ceb7d916e1
Closes-Bug: 1738979
2017-12-20 12:01:24 +00:00

22 lines
409 B
Bash
Executable File

#!/bin/bash
# Wrapper to deal with newer Ubuntu versions that don't have py2 installed
# by default.
declare -a DEPS=('apt' 'pip' 'yaml')
check_and_install() {
pkg="${1}-${2}"
if ! dpkg -s ${pkg} 2>&1 > /dev/null; then
apt-get -y install ${pkg}
fi
}
PYTHON="python3"
for dep in ${DEPS[@]}; do
check_and_install ${PYTHON} ${dep}
done
./hooks/install_deps
exec ./hooks/install.real