Merge lp:~ed.so/duplicity/paramiko.identyfile into lp:~duplicity-team/duplicity/0.7-series

Proposed by edso
Status: Merged
Merged at revision: 1032
Proposed branch: lp:~ed.so/duplicity/paramiko.identyfile
Merge into: lp:~duplicity-team/duplicity/0.7-series
Diff against target: 82 lines (+22/-16)
2 files modified
bin/duplicity.1 (+19/-13)
duplicity/backends/ssh_paramiko_backend.py (+3/-3)
To merge this branch: bzr merge lp:~ed.so/duplicity/paramiko.identyfile
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+244347@code.launchpad.net

Description of the change

fix identity file parsing of --ssh-options for paramiko
manpage fixes

To post a comment you must log in.
Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

The fix should be in commandline.py where it simply extends the list of ssh options in a list. It should instead split any quoted strings into individual options based on the rules you established in your manpage changes, then append those options to the list, thus getting rid of the quotes.

Also, the paramiko backend assumes that globals.ssh_options is a string. If I read it right, commandline makes globals.ssh_options into a list (based on the verb extend rather than append).

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

On 10.12.2014 20:59, Kenneth Loafman wrote:
> The fix should be in commandline.py where it simply extends the list of ssh options in a list. It should instead split any quoted strings into individual options based on the rules you established in your manpage changes, then append those options to the list, thus getting rid of the quotes.

would be elegant, but this works fine for most cases and is ready now. if you do not like it just merge the manpage please, so i don't have to rebase it later.

>
> Also, the paramiko backend assumes that globals.ssh_options is a string. If I read it right, commandline makes globals.ssh_options into a list (based on the verb extend rather than append).
>

nope, it's a string, based on reading the source ;)
 http://bazaar.launchpad.net/~duplicity-team/duplicity/0.7-series/view/head:/duplicity/commandline.py#L164

..ede

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/duplicity.1'
2--- bin/duplicity.1 2014-12-01 21:09:15 +0000
3+++ bin/duplicity.1 2014-12-10 19:12:11 +0000
4@@ -60,10 +60,6 @@
5 .B boto version 2.0+
6 - http://github.com/boto/boto
7 .TP
8-.BR "cloudfiles backend (deprecated)" " (e.g. Rackspace Open Cloud)"
9-.B Cloud Files Python API (deprecated)
10-- http://www.rackspace.com/knowledge_center/article/python-api-installation-for-cloud-files
11-.TP
12 .BR "cfpyrax backend" " (Rackspace Cloud) and " "hubic backend" " (hubic.com)"
13 .B Rackspace CloudFiles Pyrax API
14 - http://docs.rackspace.com/sdks/guide/content/python.html
15@@ -671,7 +667,7 @@
16 The format used is designed to be easily consumable by other programs.
17
18 .TP
19-.BI "--max_blocksize " number
20+.BI "--max-blocksize " number
21 determines the number of the blocks examined for changes during the diff process.
22 For files < 1MB the blocksize is a constant of 512.
23 For files over 1MB the size is given by:
24@@ -910,22 +906,32 @@
25
26 .TP
27 .BI "--ssh-options " options
28-Allows you to pass options to the ssh backend. The
29+Allows you to pass options to the ssh backend.
30+Can be specified multiple times or as a space separated options list.
31+The
32 .I options
33-list should be of the form "-oOpt1=parm1 -oOpt2=parm2" where the option string is
34+list should be of the form "-oOpt1='parm1' -oOpt2='parm2'" where the option string is
35 quoted and the only spaces allowed are between options. The option string
36 will be passed verbatim to both scp and sftp, whose command line syntax
37 differs slightly hence the options should therefore be given in the long option format described in
38-.BR ssh_config(5) ,
39-like in this example:
40-
41-duplicity --ssh-options="-oProtocol=2 -oIdentityFile=/my/backup/id" /home/me scp://uid@other.host/some_dir
42+.BR ssh_config(5).
43+
44+example of a list:
45+
46+duplicity --ssh-options="-oProtocol=2 -oIdentityFile='/my/backup/id'" /home/me scp://user@host/some_dir
47+
48+example with multiple parameters:
49+
50+duplicity --ssh-options="-oProtocol=2" --ssh-options="-oIdentityFile='/my/backup/id'" /home/me scp://user@host/some_dir
51
52 .B NOTE:
53-.I ssh paramiko backend
54+The
55+.I "ssh paramiko backend"
56 currently supports only the
57+.B -i
58+or
59 .B -oIdentityFile
60-setting.
61+setting. If needed provide more host specific options via ssh_config file.
62 .RE
63
64 .TP
65
66=== modified file 'duplicity/backends/ssh_paramiko_backend.py'
67--- duplicity/backends/ssh_paramiko_backend.py 2014-11-10 20:08:09 +0000
68+++ duplicity/backends/ssh_paramiko_backend.py 2014-12-10 19:12:11 +0000
69@@ -172,10 +172,10 @@
70 self.config.update({'port':int(self.config['port'])})
71 else:
72 self.config.update({'port':22})
73- # alternative ssh private key, identity file
74- m=re.search("-oidentityfile=(\S+)",globals.ssh_options,re.I)
75+ # parse ssh options for alternative ssh private key, identity file
76+ m=re.search("^(?:.+\s+)?(?:-oIdentityFile=|-i\s+)(([\"'])([^\\2]+)\\2|[\S]+).*",globals.ssh_options)
77 if (m!=None):
78- keyfilename=m.group(1)
79+ keyfilename=m.group(3) if m.group(3) else m.group(1)
80 self.config['identityfile'] = keyfilename
81 # ensure ~ is expanded and identity exists in dictionary
82 if 'identityfile' in self.config:

Subscribers

People subscribed via source and target branches