catch exception if mysqld has not been started when

perform 'cloud-setup-database'
This commit is contained in:
Frank Zhang 2010-12-16 15:29:06 -08:00
parent 1433c3ad6c
commit 032f321363

View File

@ -137,7 +137,13 @@ def run_mysql(text,user,password,host,port,debug=False):
if password: kwargs['passwd'] = password
if port: kwargs['port'] = port
conn = MySQLdb.connect(**kwargs)
try:
conn = MySQLdb.connect(**kwargs)
except:
print "Connect to mysqld failed, please make sure mysqld is running. \
You may start it by: service mysqld start"
sys.exit (-1)
cur = conn.cursor()
import re
exp = re.compile("DELIMITER (.*)$",re.M)