#!/bin/bash # Wrapper to deal with newer Ubuntu versions that don't have py2 installed # by default. check_and_install() { pkg="${1}" if ! dpkg -s ${pkg} 2>&1 > /dev/null; then apt-get -y install ${pkg} fi } if [[ $(lsb_release -sc) -eq "trusty" ]]; then juju-log "Enabling cloud archive to work around old trusty tools" # Add a random cloud archive for the Openstack python3 clients add-apt-repository --yes ppa:ubuntu-cloud-archive/mitaka-staging apt-get update check_and_install 'python3-pip' # The trusty version of tox is too low (tox version is 1.6, required is at least 2.3.1) # pip install tox to get around this and die a little inside pip3 install tox else juju-log "Installing tox" check_and_install 'tox' fi declare -a DEPS=('libssl-dev' 'libffi-dev' 'apt' 'python3-netaddr' 'python3-netifaces' 'python3-pip' 'python3-yaml' 'python-cinderclient' 'python-glanceclient' 'python-heatclient' 'python-keystoneclient' 'python-neutronclient' 'python-novaclient' 'python-swiftclient' 'python-ceilometerclient' 'openvswitch-test' 'python3-cinderclient' 'python3-glanceclient' 'python3-heatclient' 'python3-keystoneclient' 'python3-neutronclient' 'python3-novaclient' 'python3-swiftclient' 'python3-ceilometerclient') PYTHON="python" for dep in ${DEPS[@]}; do check_and_install ${dep} done exec ./hooks/install.real