[Erp5-report] r44086 rafael - /erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Mar 9 19:04:27 CET 2011
Author: rafael
Date: Wed Mar 9 19:04:26 2011
New Revision: 44086
URL: http://svn.erp5.org?rev=44086&view=rev
Log:
If update suceeded once, it is not required to repeat the command anymore.
Modified:
erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/mysql.py
Modified: erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/mysql.py
URL: http://svn.erp5.org/erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/mysql.py?rev=44086&r1=44085&r2=44086&view=diff
==============================================================================
--- erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/mysql.py [utf8] (original)
+++ erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/mysql.py [utf8] Wed Mar 9 19:04:26 2011
@@ -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)
More information about the Erp5-report
mailing list