rundaca2: if file upload fails, retry

This commit is contained in:
Daniel Marjamäki 2017-09-28 09:57:13 +02:00
parent d18e8466a9
commit a1df585ec1
1 changed files with 14 additions and 9 deletions

View File

@ -39,6 +39,8 @@ def daca2report(reportfolder):
def upload(localfolder, webfolder): def upload(localfolder, webfolder):
if len(PASSWORD) < 3: if len(PASSWORD) < 3:
return return
tries = 1
while tries <= 5:
try: try:
child = pexpect.spawn( child = pexpect.spawn(
'scp -r ' + localfolder + ' danielmarjamaki,cppcheck@web.sf.net:htdocs/' + webfolder) 'scp -r ' + localfolder + ' danielmarjamaki,cppcheck@web.sf.net:htdocs/' + webfolder)
@ -46,8 +48,11 @@ def upload(localfolder, webfolder):
child.expect('Password:') child.expect('Password:')
child.sendline(PASSWORD) child.sendline(PASSWORD)
child.interact() child.interact()
except (IOError, OSError, pexpect.TIMEOUT): return
pass except (IOError, OSError, pexpect.TIMEOUT, pexpect.EOF):
print('Sleep for 10 seconds..')
time.sleep(10)
tries = tries + 1
def daca2(foldernum): def daca2(foldernum):