#!/bin/bash
set -eu

BASE=$(readlink -f $(dirname $0)/..)

virtualenv --setuptools $BASE/openstack-tools
set +u
. $BASE/openstack-tools/bin/activate
set -u

# Need setuptools>=1.0 to manage connections when
# downloading from pypi using http_proxy and https_proxy
pip install -U 'setuptools>=1.0'

# bug #1293812 : Avoid easy_install triggering on pbr as easy_install is
# fragile.
pip install -U 'pbr>=0.5.21,<1.0'

pip install -U python-cinderclient python-novaclient python-glanceclient python-heatclient python-keystoneclient python-neutronclient python-swiftclient python-ironicclient os-apply-config

for tool in os-apply-config cinder nova glance heat keystone neutron swift ironic; do
  ln -sf $BASE/openstack-tools/bin/$tool $BASE/scripts/$tool ;
done
echo "Installed openstack client tool symlinks in $BASE/scripts"
