Fix setup-service script for RC/role checking

This patch adds checking related to RC file sourcing and user role
checking. Without these pre-conditions, the script cannot run properly.

Change-Id: Icfc3dd241cc57449712a56e7a11ef0b1b47c0826
Closes-Bug: #1470757
This commit is contained in:
tengqm
2015-11-02 00:21:50 -05:00
parent ffc656eb9f
commit 0cf9ccea76

View File

@@ -1,5 +1,18 @@
#!/bin/bash
if [[ -z $OS_AUTH_URL ]]; then
echo "This script must have proper environment variables exported."
echo "Please check if you have sourced senlinrc file or openrc file if "
echo "you are using devstack."
exit -1
fi
if [ $OS_USERNAME != 'admin' ]; then
echo "This script has to be executed as an 'admin' user."
echo "Please set environment variable OS_USERNAME to 'admin'."
exit -1
fi
if [ $# -ne 2 ]; then
echo "Usage: `basename $0` <HOST_IP> <SERVICE_PASSWORD>"
exit -1