only try to reset the db user password if it needs to be

If the user sets MYSQL_ROOT_PW then presumably the database is already
configured with that password and we don't need to run the admin
command to change it. The command was failing on my system but when I
removed the line the rest of the commands in the script worked fine.

Change-Id: Id7c41efb2f2457254997ae39626f79f7356e8608
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-01-30 11:01:24 -05:00
parent 1044a1369f
commit c9ac23bf9e

View File

@ -8,15 +8,18 @@
# The root password for the MySQL database; pass it in via
# MYSQL_ROOT_PW.
DB_ROOT_PW=${MYSQL_ROOT_PW:-insecure_slave}
if [ ! -z "$MYSQL_ROOT_PW" ]; then
DB_ROOT_PW="$MYSQL_ROOT_PW"
else
DB_ROOT_PW=insecure_slave
sudo -H mysqladmin -u root password $DB_ROOT_PW
fi
# This user and its password are used by the tests, if you change it,
# your tests might fail.
DB_USER=openstack_citest
DB_PW=openstack_citest
sudo -H mysqladmin -u root password $DB_ROOT_PW
# It's best practice to remove anonymous users from the database. If
# a anonymous user exists, then it matches first for connections and
# other connections from that host will not work.