Commit 24c9d96c authored by Rafael Monnerat's avatar Rafael Monnerat

If update suceeded once, it is not required to repeat the command anymore.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44086 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ed75e1a1
......@@ -31,15 +31,18 @@ def updateMysql(args):
mysql_command_list = args[0]
mysql_script = args[1]
sleep = 30
is_succeed = False
while True:
mysql = subprocess.Popen(mysql_command_list, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
result = mysql.communicate(mysql_script)[0]
if mysql.returncode is None:
mysql.kill()
if mysql.returncode != 0:
print 'Script failed with: %s' % result
print 'Sleeping for %ss and retrying' % sleep
else:
print 'Script succesfully run on database, exiting'
if not is_succeed:
mysql = subprocess.Popen(mysql_command_list, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
result = mysql.communicate(mysql_script)[0]
if mysql.returncode is None:
mysql.kill()
if mysql.returncode != 0:
print 'Script failed with: %s' % result
print 'Sleeping for %ss and retrying' % sleep
else:
is_succeed = True
print 'Script succesfully run on database, exiting'
time.sleep(sleep)
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