[openstack-nova] openstack-nova-db-setup: allow a NUL mysql password

Pádraig Brady pbrady at fedoraproject.org
Fri Jan 20 16:17:36 UTC 2012


commit 47198016f0ab1c69fdc0e7edb2107322ebcb2c1f
Author: Derek Higgins <derekh at redhat.com>
Date:   Fri Jan 20 16:15:04 2012 +0000

    openstack-nova-db-setup: allow a NUL mysql password
    
    Allow an empty string to be used as a mysql root password

 openstack-nova-db-setup |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/openstack-nova-db-setup b/openstack-nova-db-setup
index 7530af0..606df58 100755
--- a/openstack-nova-db-setup
+++ b/openstack-nova-db-setup
@@ -64,7 +64,6 @@ start_mysql_server() {
 	systemctl start mysqld.service
 }
 
-MYSQL_ROOT_PW=""
 MYSQL_NOVA_PW_DEFAULT="nova"
 MYSQL_NOVA_PW=${MYSQL_NOVA_PW_DEFAULT}
 NOVA_CONFIG="/etc/nova/nova.conf"
@@ -153,7 +152,7 @@ fi
 
 if [ $NEW_MYSQL_INSTALL -eq 1 ]
 then
-	if [ -z "${MYSQL_ROOT_PW}" ] ; then
+	if [ ! "${MYSQL_ROOT_PW+defined}" ] ; then
 		echo "Since this is a fresh installation of MySQL, please set a password for the 'root' mysql user."
 
 		PW_MATCH=0
@@ -178,7 +177,7 @@ then
 		echo "Failed to set password for 'root' MySQL user."
 		exit 1
 	fi
-elif [ -z "${MYSQL_ROOT_PW}" ] ; then
+elif [ ! "${MYSQL_ROOT_PW+defined}" ] ; then
 	printf "Please enter the password for the 'root' MySQL user: "
 	read -s MYSQL_ROOT_PW
 	echo
@@ -188,7 +187,7 @@ fi
 # Sanity check MySQL credentials.
 
 MYSQL_ROOT_PW_ARG=""
-if [ -n "${MYSQL_ROOT_PW}" ]
+if [ "${MYSQL_ROOT_PW+defined}" ]
 then
 	MYSQL_ROOT_PW_ARG="--password=${MYSQL_ROOT_PW}"
 fi


More information about the scm-commits mailing list