No need to check localrc for password. Also use TOP_DIR as described by smoser.

This commit is contained in:
Anthony Young 2011-10-12 14:08:08 -07:00
parent 66b8bbcbd8
commit b4db225494

View file

@ -43,8 +43,8 @@ if [ ! -d $FILES ]; then
exit 1
fi
# Keep track of the current working directory.
CWD=`pwd`
# Keep track of the current devstack directory.
TOP_DIR=$(cd $(dirname "$0") && pwd)
# OpenStack is designed to be run as a regular user (Dashboard will fail to run
# as root, since apache refused to startup serve content from root user). If
@ -155,18 +155,17 @@ function read_password {
var=$1; msg=$2
pw=${!var}
localrc=$CWD/localrc
localrc=$TOP_DIR/localrc
# If the password is not defined yet, proceed to prompt user for a password.
if [ ! $pw ]; then
# If there is no localrc file, create one
if [ ! -e localrc ]; then
touch localrc
if [ ! -e $localrc ]; then
touch $localrc
fi
# Presumably if we got this far it can only be that our localrc is missing
# the required password. Prompt user for a password and write to localrc.
if ! grep -q $1 localrc; then
echo ''
echo '################################################################################'
echo $msg
@ -181,8 +180,7 @@ function read_password {
pw=`openssl rand -hex 10`
fi
eval "$var=$pw"
echo "$var=$pw" >> localrc
fi
echo "$var=$pw" >> $localrc
fi
set -o xtrace
}