-
-
Save fmobus/8982558 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function white { | |
echo -e "\033[37m$1\033[0m" | |
} | |
function red { | |
echo -e "\033[31m$1\033[0m" | |
} | |
PIP_PATH=$(which pip) | |
if [ $? -ne 0 ]; then | |
white 'pip not found. Attempting to install it...' | |
sudo easy_install pip | |
fi | |
python -c "import pip" | |
if [ $? -ne 0 ]; then | |
red "your pip is not working. It is recommended you install it again using \`sudo easy_install pip\'" | |
exit 1 | |
fi | |
INSTALL_TEMP=`mktemp -d ${TMPDIR}openstacktoolsetXXXXXX` | |
pushd $INSTALL_TEMP > /dev/null | |
white 'Installing pbr...' | |
git clone git://github.com/openstack-dev/pbr.git > /dev/null | |
pushd pbr | |
sudo python setup.py install > /dev/null | |
popd | |
clients=(cinder glance heat keystone neutron nova swift) | |
for c in ${clients[@]}; do | |
white "Checking if ${c} is already installed..." | |
client_path=$(which $c) | |
if [ $? -eq 0 ]; then | |
white "${c} is already installed at ${client_path}" | |
continue | |
fi | |
white "Installing ${c}..." | |
git clone git://github.com/openstack/python-${c}client.git > /dev/null | |
pushd python-${c}client | |
sudo python setup.py install > /dev/null | |
if [ $? -ne 0 ]; then | |
echo "installing of ${c} failed. Cannot continue." | |
exit 1 | |
fi | |
popd | |
done | |
popd $INSTALL_TEMP | |
sudo rm -rf $INSTALL_TEMP | |
error=0 | |
vars=(OS_TENANT_NAME OS_USERNAME OS_PASSWORD OS_AUTH_URL OS_NO_CACHE OS_SERVICE_TOKEN SERVICE_ENDPOINT) | |
for v in ${vars[@]}; do | |
value=$(env | grep $v | cut -f 2- -d '=') | |
if [ -z "$value" ]; then | |
red "$v is not set" | |
error=1 | |
fi | |
done | |
if [ $error -eq 0 ]; then | |
white "All RLPC environment variables defined" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment