From c9ac23bf9e512750acf52d8f4b175df49d65cf66 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Tue, 30 Jan 2018 11:01:24 -0500 Subject: [PATCH] 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 --- tools/test-setup.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/test-setup.sh b/tools/test-setup.sh index 07a07854..a5bb6b8d 100755 --- a/tools/test-setup.sh +++ b/tools/test-setup.sh @@ -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.