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

Subscribers

People subscribed via source and target branches