Ensure that python3 really is installed on upgrade charm
During a switch from py2 to py3, need to ensure that the required python3 versions of the required libraries are installed. Change-Id: I0dbfab4819b873e0476879e42fbad1d40cdf699d
This commit is contained in:
parent
3a473381e5
commit
742f7f812d
|
@ -1 +0,0 @@
|
|||
rabbitmq_server_relations.py
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash -e
|
||||
# Wrapper to ensure that the required py3 versions are installed if upgrading
|
||||
# from a py2 charm to a py3 based charm.
|
||||
|
||||
declare -a DEPS=('apt' 'netaddr' 'netifaces' 'pip' 'yaml' 'dnspython' 'requests')
|
||||
|
||||
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
|
||||
|
||||
# python3-croniter not available on trusty
|
||||
[ "$( lsb_release -sc )" != "trusty" ] && check_and_install ${PYTHON} croniter
|
||||
|
||||
exec ./hooks/upgrade-charm.real
|
|
@ -0,0 +1 @@
|
|||
rabbitmq_server_relations.py
|
Loading…
Reference in New Issue