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