make sample_data.sh account for the default options in keystone.conf

Closes-Bug: 1394816

Change-Id: Ifb19d09a1ed8e82aebcaea82783480176daa3536
This commit is contained in:
Guang Yee 2014-11-20 16:49:16 -08:00
parent 1ee9468673
commit cdda91986b
1 changed files with 8 additions and 0 deletions

View File

@ -68,7 +68,15 @@ fi
# Extract some info from Keystone's configuration file
if [[ -r "$KEYSTONE_CONF" ]]; then
CONFIG_SERVICE_TOKEN=$(sed 's/[[:space:]]//g' $KEYSTONE_CONF | grep ^admin_token= | cut -d'=' -f2)
if [[ -z "${CONFIG_SERVICE_TOKEN}" ]]; then
# default config options are commented out, so lets try those
CONFIG_SERVICE_TOKEN=$(sed 's/[[:space:]]//g' $KEYSTONE_CONF | grep ^\#admin_token= | cut -d'=' -f2)
fi
CONFIG_ADMIN_PORT=$(sed 's/[[:space:]]//g' $KEYSTONE_CONF | grep ^admin_port= | cut -d'=' -f2)
if [[ -z "${CONFIG_ADMIN_PORT}" ]]; then
# default config options are commented out, so lets try those
CONFIG_ADMIN_PORT=$(sed 's/[[:space:]]//g' $KEYSTONE_CONF | grep ^\#admin_port= | cut -d'=' -f2)
fi
fi
export OS_SERVICE_TOKEN=${OS_SERVICE_TOKEN:-$CONFIG_SERVICE_TOKEN}