DBG.write("cmd", cmd)
- for nbtry in range(0,3): # retries case of network problem
+ # git commands may fail sometimes for various raisons (big module, network troubles, tuleap maintenance)
+ # therefore we give several tries
+ i_try=0
+ max_number_of_tries=3
+ sleep_delay=30 # seconds
+ while (True):
+ i_try+=1
rc = UTS.Popen(cmd, cwd=str(where.dir()), env=environment.environ.environ, logger=logger)
- if rc.isOk(): break
- time.sleep(30) # wait a little
+ if rc.isOk() or (i_try>=max_number_of_tries):
+ break
+ logger.write('\ngit command failed! Wait %d seconds and give an other try (%d/%d)\n' % (sleep_delay,i_try+1,max_number_of_tries), 3)
+ time.sleep(sleep_delay) # wait a little
return rc.isOk()
shell=True,
stdout=logger.logTxtFile,
stderr=subprocess.STDOUT)
- return (res == 0)
\ No newline at end of file
+ return (res == 0)