]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
heat tools : heat-db-drop prompt for missing password
authorSteven Hardy <shardy@redhat.com>
Thu, 5 Jul 2012 09:46:53 +0000 (10:46 +0100)
committerSteven Hardy <shardy@redhat.com>
Thu, 5 Jul 2012 09:46:53 +0000 (10:46 +0100)
heat-db-drop fails to drop databases when called via
tools/openstack erase, so prompt for password when
not passed as a CLI argument.

Change-Id: I4930b8457e0f3e1488187b35be9737578595c387
Signed-off-by: Steven Hardy <shardy@redhat.com>
tools/heat-db-drop

index e137e8ae5ee06007bfeb21b7f3010da7ac65d011..313560dc0ff6a4a9914ec6e10047718c66fd278a 100755 (executable)
@@ -17,6 +17,13 @@ while [ $# -gt 0 ]; do
     shift
 done
 
+if [ ! "${MYSQL_ROOT_PW_ARG+defined}" ] ; then
+    printf "Please enter the password for the 'root' MySQL user: "
+    read -s MYSQL_ROOT_PW
+    MYSQL_ROOT_PW_ARG="--password=${MYSQL_ROOT_PW}"
+    echo
+fi
+
 cat << EOF | mysql -u root ${MYSQL_ROOT_PW_ARG}
 DROP USER '${DATABASE}'@'localhost';
 DROP USER '${DATABASE}'@'%';