Merge lp:~tblue/duplicity/paramiko-fix-delete-retry into lp:duplicity/0.6

Proposed by Tilman Blumenbach
Status: Merged
Merged at revision: 915
Proposed branch: lp:~tblue/duplicity/paramiko-fix-delete-retry
Merge into: lp:duplicity/0.6
Diff against target: 41 lines (+13/-11)
1 file modified
duplicity/backends/_ssh_paramiko.py (+13/-11)
To merge this branch: bzr merge lp:~tblue/duplicity/paramiko-fix-delete-retry
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+159992@code.launchpad.net

Description of the change

This fixes bug #1115715, which is really annoying. Basically it makes using the Paramiko backend with the default settings impossible.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'duplicity/backends/_ssh_paramiko.py'
2--- duplicity/backends/_ssh_paramiko.py 2012-09-19 04:55:59 +0000
3+++ duplicity/backends/_ssh_paramiko.py 2013-04-21 23:04:25 +0000
4@@ -352,12 +352,10 @@
5 def delete(self, filename_list):
6 """deletes all files in the list on the remote side. In scp mode unavoidable quoting issues
7 will cause failures if filenames containing single quotes are encountered."""
8- for n in range(1, globals.num_retries+1):
9- if n > 1:
10- # sleep before retry
11- time.sleep(self.retry_delay)
12- try:
13- for fn in filename_list:
14+ for fn in filename_list:
15+ # Try to delete each file several times before giving up completely.
16+ for n in range(1, globals.num_retries+1):
17+ try:
18 if (globals.use_scp):
19 self.runremote("rm '%s/%s'" % (self.remote_dir,fn),False,"scp rm ")
20 else:
21@@ -365,11 +363,15 @@
22 self.sftp.remove(fn)
23 except Exception, e:
24 raise BackendException("sftp rm %s failed: %s" % (fn,e))
25- except Exception, e:
26- if n == globals.num_retries:
27- log.FatalError(str(e), log.ErrorCode.backend_error)
28- else:
29- log.Warn("%s (Try %d of %d) Will retry in %d seconds." % (e,n,globals.num_retries,self.retry_delay))
30+
31+ # If we get here, we deleted this file successfully. Move on to the next one.
32+ break
33+ except Exception, e:
34+ if n == globals.num_retries:
35+ log.FatalError(str(e), log.ErrorCode.backend_error)
36+ else:
37+ log.Warn("%s (Try %d of %d) Will retry in %d seconds." % (e,n,globals.num_retries,self.retry_delay))
38+ time.sleep(self.retry_delay)
39
40 def runremote(self,cmd,ignoreexitcode=False,errorprefix=""):
41 """small convenience function that opens a shell channel, runs remote command and returns

Subscribers

People subscribed via source and target branches