duplicity-talk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Duplicity-talk] Error detection in FTP backend.


From: Kenneth Loafman
Subject: Re: [Duplicity-talk] Error detection in FTP backend.
Date: Fri, 27 Mar 2009 20:17:55 -0500
User-agent: Thunderbird 2.0.0.21 (X11/20090318)

Kenneth Loafman wrote:
> I'll have a patch out soon to fix the problem, but for now, try using
> the "--ftp-passive" option.  This would be the error if the regular
> connection to the data port (20) was not available.

OK, not as soon as I wanted... Trouble reproducing the problem took more
time that the patch itself!

Here it is.  Let me know how it works.

...Thanks,
...Ken

Index: duplicity/backends/ftpbackend.py
===================================================================
RCS file: /sources/duplicity/duplicity/duplicity/backends/ftpbackend.py,v
retrieving revision 1.15
diff -u -r1.15 ftpbackend.py
--- duplicity/backends/ftpbackend.py    18 Mar 2009 11:48:53 -0000      1.15
+++ duplicity/backends/ftpbackend.py    28 Mar 2009 01:15:39 -0000
@@ -140,9 +140,11 @@
                                           "(?i)cannot open local file .* for 
writing",
                                           "(?i)get .*: server said: .*: no 
such file or directory",
                                           "(?i)put .*: server said: .*: no 
such file or directory",
-                                          "(?i)could not write to control 
stream: Broken pipe.",
+                                          "(?i)could not write to control 
stream: Broken pipe",
                                           "(?i)login incorrect",
-                                          "(?i)could not open",],
+                                          "(?i)could not open",
+                                          "(?i)get .*: server said: .*: 
connection refused",
+                                          "(?i)put .*: server said: .*: 
connection refused"],
                                           globals.timeout)
                     log.Log("State = %s, Before = '%s'" % (state, 
filter_ansi(child.before)), 9)
                     if match == 0:
@@ -178,6 +180,10 @@
                         log.Log("Incorrect login / could not open host", 1)
                         err = True
                         break
+                    elif match in (10, 11):
+                        log.Log("Unable to build data connection: connection 
refused", 1)
+                        err = True
+                        break
 
             child.close(force = True)
             if (not err) and (child.exitstatus == 0):
@@ -189,12 +195,12 @@
 
     def put(self, source_path, remote_filename):
         """Transfer source_path to remote_filename"""
-        commands = ["put -z %s %s" % (source_path.name, remote_filename),]
+        commands = ["put -f -z %s %s" % (source_path.name, remote_filename),]
         res = self.run_ftp_command_list(commands)
 
     def get(self, remote_filename, local_path):
         """Get remote filename, saving it to local_path"""
-        commands = ["get -z %s %s" % (remote_filename, local_path.name),]
+        commands = ["get -f -z %s %s" % (remote_filename, local_path.name),]
         res = self.run_ftp_command_list(commands)
         local_path.setdata()
 

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]