Merge lp:~moritzm/duplicity/duplicity into lp:~duplicity-team/duplicity/0.7-series

Proposed by Kenneth Loafman
Status: Merged
Merged at revision: 1006
Proposed branch: lp:~moritzm/duplicity/duplicity
Merge into: lp:~duplicity-team/duplicity/0.7-series
Diff against target: 146 lines (+4/-2)
1 file modified
duplicity/backends/ftpbackend.py (+4/-2)
To merge this branch: bzr merge lp:~moritzm/duplicity/duplicity
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+238157@code.launchpad.net
To post a comment you must log in.
Revision history for this message
edso (ed.so) wrote :

On 18.10.2014 21:45, <email address hidden> wrote:
> The proposal to merge lp:~moritzm/duplicity/duplicity into lp:duplicity has been updated.
>
> Status: Needs review => Merged
>
> For more details, see:
> https://code.launchpad.net/~moritzm/duplicity/duplicity/+merge/238157
>

i don't like this!.. it removes a perfectly working backend, namely ncftp. can we rather keep both and let the user select which one to choose? i could live with making lftp the default.

..ede

Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

Let's see if we need to. NcFTP has not been updated in a long time and
does not support IPv6. We can always restore the old version.

On Sat, Oct 18, 2014 at 3:21 PM, edso <email address hidden> wrote:

> On 18.10.2014 21:45, <email address hidden> wrote:
> > The proposal to merge lp:~moritzm/duplicity/duplicity into lp:duplicity
> has been updated.
> >
> > Status: Needs review => Merged
> >
> > For more details, see:
> > https://code.launchpad.net/~moritzm/duplicity/duplicity/+merge/238157
> >
>
> i don't like this!.. it removes a perfectly working backend, namely ncftp.
> can we rather keep both and let the user select which one to choose? i
> could live with making lftp the default.
>
> ..ede
>
> --
> https://code.launchpad.net/~moritzm/duplicity/duplicity/+merge/238157
> You proposed lp:~moritzm/duplicity/duplicity for merging.
>

Revision history for this message
edso (ed.so) wrote :

how about a similar solution like ssh? we periodically see users having issues with paramiko. it's good to have the alternative if the default fails for what reason ever.

never came around to do so, because i never needed it, like the patch does planned to establish lftp as a ftp backend, although as an alternative one. switching would have been done via url scheme eg.

lftp+ftp://
ncftp+ftp://

while at it i could streamline this switching for ssh as well eg.

paramiko+sftp://
pexpect+sftp://

retiring the --ssh-backend switch.

what do you guys think? ..ede

On 18.10.2014 22:42, Kenneth Loafman wrote:
> Let's see if we need to. NcFTP has not been updated in a long time and
> does not support IPv6. We can always restore the old version.
>
>
> On Sat, Oct 18, 2014 at 3:21 PM, edso <email address hidden> wrote:
>
>> On 18.10.2014 21:45, <email address hidden> wrote:
>>> The proposal to merge lp:~moritzm/duplicity/duplicity into lp:duplicity
>> has been updated.
>>>
>>> Status: Needs review => Merged
>>>
>>> For more details, see:
>>> https://code.launchpad.net/~moritzm/duplicity/duplicity/+merge/238157
>>>
>>
>> i on't like this!.. it removes a perfectly working backend, namely ncftp.
>> can we rather keep both and let the user select which one to choose? i
>> could live with making lftp the default.
>>
>> ..ede
>>

Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

Since this is a new release and that is a clean solution, I say go for it.
Thanks ede!

On Sun, Oct 19, 2014 at 5:21 AM, edso <email address hidden> wrote:

> how about a similar solution like ssh? we periodically see users having
> issues with paramiko. it's good to have the alternative if the default
> fails for what reason ever.
>
> never came around to do so, because i never needed it, like the patch does
> planned to establish lftp as a ftp backend, although as an alternative one.
> switching would have been done via url scheme eg.
>
> lftp+ftp://
> ncftp+ftp://
>
> while at it i could streamline this switching for ssh as well eg.
>
> paramiko+sftp://
> pexpect+sftp://
>
> retiring the --ssh-backend switch.
>
> what do you guys think? ..ede
>
> On 18.10.2014 22:42, Kenneth Loafman wrote:
> > Let's see if we need to. NcFTP has not been updated in a long time and
> > does not support IPv6. We can always restore the old version.
> >
> >
> > On Sat, Oct 18, 2014 at 3:21 PM, edso <email address hidden> wrote:
> >
> >> On 18.10.2014 21:45, <email address hidden> wrote:
> >>> The proposal to merge lp:~moritzm/duplicity/duplicity into lp:duplicity
> >> has been updated.
> >>>
> >>> Status: Needs review => Merged
> >>>
> >>> For more details, see:
> >>> https://code.launchpad.net/~moritzm/duplicity/duplicity/+merge/238157
> >>>
> >>
> >> i on't like this!.. it removes a perfectly working backend, namely
> ncftp.
> >> can we rather keep both and let the user select which one to choose? i
> >> could live with making lftp the default.
> >>
> >> ..ede
> >>
>
> --
> https://code.launchpad.net/~moritzm/duplicity/duplicity/+merge/238157
> You proposed lp:~moritzm/duplicity/duplicity for merging.
>

Revision history for this message
edso (ed.so) wrote :

very well.. i'll put it on my list.. don't hesitate to release 0.7.0 though.. ede

On 19.10.2014 14:39, Kenneth Loafman wrote:
> Since this is a new release and that is a clean solution, I say go for it.
> Thanks ede!
>
>
> On Sun, Oct 19, 2014 at 5:21 AM, edso <email address hidden> wrote:
>
>> how about a similar solution like ssh? we periodically see users having
>> issues with paramiko. it's good to have the alternative if the default
>> fails for what reason ever.
>>
>> never came around to do so, because i never needed it, like the patch does
>> planned to establish lftp as a ftp backend, although as an alternative one.
>> switching would have been done via url scheme eg.
>>
>> lftp+ftp://
>> ncftp+ftp://
>>
>> while at it i could streamline this switching for ssh as well eg.
>>
>> paramiko+sftp://
>> pexpect+sftp://
>>
>> retiring the --ssh-backend switch.
>>
>> what do you guys think? ..ede
>>
>> On 18.10.2014 22:42, Kenneth Loafman wrote:
>>> Let's see if we need to. NcFTP has not been updated in a long time and
>>> does not support IPv6. We can always restore the old version.
>>>
>>>
>>> On Sat, Oct 18, 2014 at 3:21 PM, edso <email address hidden> wrote:
>>>
>>>> On 18.10.2014 21:45, <email address hidden> wrote:
>>>>> The proposal to merge lp:~moritzm/duplicity/duplicity into lp:duplicity
>>>> has been updated.
>>>>>
>>>>> Status: Needs review => Merged
>>>>>
>>>>> For more details, see:
>>>>> https://code.launchpad.net/~moritzm/duplicity/duplicity/+merge/238157
>>>>>
>>>>
>>>> i on't like this!.. it removes a perfectly working backend, namely
>> ncftp.
>>>> can we rather keep both and let the user select which one to choose? i
>>>> could live with making lftp the default.
>>>>
>>>> ..ede
>>>>
>>
>> --
>> https://code.launchpad.net/~moritzm/duplicity/duplicity/+merge/238157
>> You proposed lp:~moritzm/duplicity/duplicity for merging.
>>
>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== removed file 'duplicity/backends/ftpbackend.py'
--- duplicity/backends/ftpbackend.py 2014-04-26 12:54:37 +0000
+++ duplicity/backends/ftpbackend.py 1970-01-01 00:00:00 +0000
@@ -1,114 +0,0 @@
1# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
2#
3# Copyright 2002 Ben Escoto <ben@emerose.org>
4# Copyright 2007 Kenneth Loafman <kenneth@loafman.com>
5#
6# This file is part of duplicity.
7#
8# Duplicity is free software; you can redistribute it and/or modify it
9# under the terms of the GNU General Public License as published by the
10# Free Software Foundation; either version 2 of the License, or (at your
11# option) any later version.
12#
13# Duplicity is distributed in the hope that it will be useful, but
14# WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16# General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with duplicity; if not, write to the Free Software Foundation,
20# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
22import os.path
23import urllib
24
25import duplicity.backend
26from duplicity import globals
27from duplicity import log
28from duplicity import tempdir
29
30class FTPBackend(duplicity.backend.Backend):
31 """Connect to remote store using File Transfer Protocol"""
32 def __init__(self, parsed_url):
33 duplicity.backend.Backend.__init__(self, parsed_url)
34
35 # we expect an error return, so go low-level and ignore it
36 try:
37 p = os.popen("ncftpls -v")
38 fout = p.read()
39 ret = p.close()
40 except Exception:
41 pass
42 # the expected error is 8 in the high-byte and some output
43 if ret != 0x0800 or not fout:
44 log.FatalError("NcFTP not found: Please install NcFTP version 3.1.9 or later",
45 log.ErrorCode.ftp_ncftp_missing)
46
47 # version is the second word of the first line
48 version = fout.split('\n')[0].split()[1]
49 if version < "3.1.9":
50 log.FatalError("NcFTP too old: Duplicity requires NcFTP version 3.1.9,"
51 "3.2.1 or later. Version 3.2.0 will not work properly.",
52 log.ErrorCode.ftp_ncftp_too_old)
53 elif version == "3.2.0":
54 log.Warn("NcFTP (ncftpput) version 3.2.0 may fail with duplicity.\n"
55 "see: http://www.ncftpd.com/ncftp/doc/changelog.html\n"
56 "If you have trouble, please upgrade to 3.2.1 or later",
57 log.WarningCode.ftp_ncftp_v320)
58 log.Notice("NcFTP version is %s" % version)
59
60 self.parsed_url = parsed_url
61
62 self.url_string = duplicity.backend.strip_auth_from_url(self.parsed_url)
63
64 # This squelches the "file not found" result from ncftpls when
65 # the ftp backend looks for a collection that does not exist.
66 # version 3.2.2 has error code 5, 1280 is some legacy value
67 self.popen_breaks[ 'ncftpls' ] = [ 5, 1280 ]
68
69 # Use an explicit directory name.
70 if self.url_string[-1] != '/':
71 self.url_string += '/'
72
73 self.password = self.get_password()
74
75 if globals.ftp_connection == 'regular':
76 self.conn_opt = '-E'
77 else:
78 self.conn_opt = '-F'
79
80 self.tempfile, self.tempname = tempdir.default().mkstemp()
81 os.write(self.tempfile, "host %s\n" % self.parsed_url.hostname)
82 os.write(self.tempfile, "user %s\n" % self.parsed_url.username)
83 os.write(self.tempfile, "pass %s\n" % self.password)
84 os.close(self.tempfile)
85 self.flags = "-f %s %s -t %s -o useCLNT=0,useHELP_SITE=0 " % \
86 (self.tempname, self.conn_opt, globals.timeout)
87 if parsed_url.port != None and parsed_url.port != 21:
88 self.flags += " -P '%s'" % (parsed_url.port)
89
90 def _put(self, source_path, remote_filename):
91 remote_path = os.path.join(urllib.unquote(self.parsed_url.path.lstrip('/')), remote_filename).rstrip()
92 commandline = "ncftpput %s -m -V -C '%s' '%s'" % \
93 (self.flags, source_path.name, remote_path)
94 self.subprocess_popen(commandline)
95
96 def _get(self, remote_filename, local_path):
97 remote_path = os.path.join(urllib.unquote(self.parsed_url.path), remote_filename).rstrip()
98 commandline = "ncftpget %s -V -C '%s' '%s' '%s'" % \
99 (self.flags, self.parsed_url.hostname, remote_path.lstrip('/'), local_path.name)
100 self.subprocess_popen(commandline)
101
102 def _list(self):
103 # Do a long listing to avoid connection reset
104 commandline = "ncftpls %s -l '%s'" % (self.flags, self.url_string)
105 _, l, _ = self.subprocess_popen(commandline)
106 # Look for our files as the last element of a long list line
107 return [x.split()[-1] for x in l.split('\n') if x and not x.startswith("total ")]
108
109 def _delete(self, filename):
110 commandline = "ncftpls %s -l -X 'DELE %s' '%s'" % \
111 (self.flags, filename, self.url_string)
112 self.subprocess_popen(commandline)
113
114duplicity.backend.register_backend("ftp", FTPBackend)
1150
=== renamed file 'duplicity/backends/ftpsbackend.py' => 'duplicity/backends/ftpbackend.py'
--- duplicity/backends/ftpsbackend.py 2014-04-28 02:49:39 +0000
+++ duplicity/backends/ftpbackend.py 2014-10-13 13:20:56 +0000
@@ -3,6 +3,7 @@
3# Copyright 2002 Ben Escoto <ben@emerose.org>3# Copyright 2002 Ben Escoto <ben@emerose.org>
4# Copyright 2007 Kenneth Loafman <kenneth@loafman.com>4# Copyright 2007 Kenneth Loafman <kenneth@loafman.com>
5# Copyright 2010 Marcel Pennewiss <opensource@pennewiss.de>5# Copyright 2010 Marcel Pennewiss <opensource@pennewiss.de>
6# Copyright 2014 Moritz Maisel <moritz@maisel.name>
6#7#
7# This file is part of duplicity.8# This file is part of duplicity.
8#9#
@@ -30,7 +31,7 @@
30from duplicity import log31from duplicity import log
31from duplicity import tempdir32from duplicity import tempdir
3233
33class FTPSBackend(duplicity.backend.Backend):34class FTPBackend(duplicity.backend.Backend):
34 """Connect to remote store using File Transfer Protocol"""35 """Connect to remote store using File Transfer Protocol"""
35 def __init__(self, parsed_url):36 def __init__(self, parsed_url):
36 duplicity.backend.Backend.__init__(self, parsed_url)37 duplicity.backend.Backend.__init__(self, parsed_url)
@@ -109,4 +110,5 @@
109 commandline = "lftp -c 'source %s;cd \'%s\';rm \'%s\''" % (self.tempname, remote_dir, filename)110 commandline = "lftp -c 'source %s;cd \'%s\';rm \'%s\''" % (self.tempname, remote_dir, filename)
110 self.subprocess_popen(commandline)111 self.subprocess_popen(commandline)
111112
112duplicity.backend.register_backend("ftps", FTPSBackend)113duplicity.backend.register_backend("ftp", FTPBackend)
114duplicity.backend.register_backend("ftps", FTPBackend)

Subscribers

People subscribed via source and target branches