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,15 +39,20 @@ def daca2report(reportfolder):
def upload(localfolder, webfolder): def upload(localfolder, webfolder):
if len(PASSWORD) < 3: if len(PASSWORD) < 3:
return return
try: tries = 1
child = pexpect.spawn( while tries <= 5:
'scp -r ' + localfolder + ' danielmarjamaki,cppcheck@web.sf.net:htdocs/' + webfolder) try:
# child.expect('upload@trac.cppcheck.net\'s password:') child = pexpect.spawn(
child.expect('Password:') 'scp -r ' + localfolder + ' danielmarjamaki,cppcheck@web.sf.net:htdocs/' + webfolder)
child.sendline(PASSWORD) # child.expect('upload@trac.cppcheck.net\'s password:')
child.interact() child.expect('Password:')
except (IOError, OSError, pexpect.TIMEOUT): child.sendline(PASSWORD)
pass child.interact()
return
except (IOError, OSError, pexpect.TIMEOUT, pexpect.EOF):
print('Sleep for 10 seconds..')
time.sleep(10)
tries = tries + 1
def daca2(foldernum): def daca2(foldernum):