Commit 29e65e56 authored by Vincent Pelletier's avatar Vincent Pelletier

Make "socket" parameter optional.

parent 02aaefe2
...@@ -42,7 +42,9 @@ def updateMysql(args): ...@@ -42,7 +42,9 @@ def updateMysql(args):
sleep = 30 sleep = 30
is_succeed = False is_succeed = False
while True: while True:
mysql_upgrade_list = [conf['mysql_upgrade_binary'], '--no-defaults', '--user=root', '--socket=%s' % conf['socket']] mysql_upgrade_list = [conf['mysql_upgrade_binary'], '--no-defaults', '--user=root']
if 'socket' in conf:
mysql_upgrade_list.append('--socket=' + conf['socket'])
mysql_upgrade = subprocess.Popen(mysql_upgrade_list, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) mysql_upgrade = subprocess.Popen(mysql_upgrade_list, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
result = mysql_upgrade.communicate()[0] result = mysql_upgrade.communicate()[0]
if mysql_upgrade.returncode is None: if mysql_upgrade.returncode is None:
...@@ -54,7 +56,9 @@ def updateMysql(args): ...@@ -54,7 +56,9 @@ def updateMysql(args):
print "MySQL database upgraded with result:\n%s" % result print "MySQL database upgraded with result:\n%s" % result
else: else:
print "No need to upgrade MySQL database" print "No need to upgrade MySQL database"
mysql_list = [conf['mysql_binary'].strip(), '--no-defaults', '-B', '--user=root', '--socket=%s' % conf['socket']] mysql_list = [conf['mysql_binary'].strip(), '--no-defaults', '-B', '--user=root']
if 'socket' in conf:
mysql_list.append('--socket=' + conf['socket'])
mysql = subprocess.Popen(mysql_list, stdin=subprocess.PIPE, mysql = subprocess.Popen(mysql_list, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT) stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
result = mysql.communicate(conf['mysql_script'])[0] result = mysql.communicate(conf['mysql_script'])[0]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment