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
=== modified file 'bin/duplicity.1'
--- bin/duplicity.1 2014-12-01 21:09:15 +0000
+++ bin/duplicity.1 2014-12-10 19:12:11 +0000
@@ -60,10 +60,6 @@
60.B boto version 2.0+60.B boto version 2.0+
61- http://github.com/boto/boto61- http://github.com/boto/boto
62.TP62.TP
63.BR "cloudfiles backend (deprecated)" " (e.g. Rackspace Open Cloud)"
64.B Cloud Files Python API (deprecated)
65- http://www.rackspace.com/knowledge_center/article/python-api-installation-for-cloud-files
66.TP
67.BR "cfpyrax backend" " (Rackspace Cloud) and " "hubic backend" " (hubic.com)"63.BR "cfpyrax backend" " (Rackspace Cloud) and " "hubic backend" " (hubic.com)"
68.B Rackspace CloudFiles Pyrax API64.B Rackspace CloudFiles Pyrax API
69- http://docs.rackspace.com/sdks/guide/content/python.html65- http://docs.rackspace.com/sdks/guide/content/python.html
@@ -671,7 +667,7 @@
671The format used is designed to be easily consumable by other programs.667The format used is designed to be easily consumable by other programs.
672668
673.TP669.TP
674.BI "--max_blocksize " number670.BI "--max-blocksize " number
675determines the number of the blocks examined for changes during the diff process.671determines the number of the blocks examined for changes during the diff process.
676For files < 1MB the blocksize is a constant of 512.672For files < 1MB the blocksize is a constant of 512.
677For files over 1MB the size is given by:673For files over 1MB the size is given by:
@@ -910,22 +906,32 @@
910906
911.TP907.TP
912.BI "--ssh-options " options908.BI "--ssh-options " options
913Allows you to pass options to the ssh backend. The909Allows you to pass options to the ssh backend.
910Can be specified multiple times or as a space separated options list.
911The
914.I options912.I options
915list should be of the form "-oOpt1=parm1 -oOpt2=parm2" where the option string is913list should be of the form "-oOpt1='parm1' -oOpt2='parm2'" where the option string is
916quoted and the only spaces allowed are between options. The option string914quoted and the only spaces allowed are between options. The option string
917will be passed verbatim to both scp and sftp, whose command line syntax915will be passed verbatim to both scp and sftp, whose command line syntax
918differs slightly hence the options should therefore be given in the long option format described in916differs slightly hence the options should therefore be given in the long option format described in
919.BR ssh_config(5) ,917.BR ssh_config(5).
920like in this example:918
921919example of a list:
922duplicity --ssh-options="-oProtocol=2 -oIdentityFile=/my/backup/id" /home/me scp://uid@other.host/some_dir920
921duplicity --ssh-options="-oProtocol=2 -oIdentityFile='/my/backup/id'" /home/me scp://user@host/some_dir
922
923example with multiple parameters:
924
925duplicity --ssh-options="-oProtocol=2" --ssh-options="-oIdentityFile='/my/backup/id'" /home/me scp://user@host/some_dir
923926
924.B NOTE:927.B NOTE:
925.I ssh paramiko backend928The
929.I "ssh paramiko backend"
926currently supports only the930currently supports only the
931.B -i
932or
927.B -oIdentityFile933.B -oIdentityFile
928setting.934setting. If needed provide more host specific options via ssh_config file.
929.RE935.RE
930936
931.TP937.TP
932938
=== modified file 'duplicity/backends/ssh_paramiko_backend.py'
--- duplicity/backends/ssh_paramiko_backend.py 2014-11-10 20:08:09 +0000
+++ duplicity/backends/ssh_paramiko_backend.py 2014-12-10 19:12:11 +0000
@@ -172,10 +172,10 @@
172 self.config.update({'port':int(self.config['port'])})172 self.config.update({'port':int(self.config['port'])})
173 else:173 else:
174 self.config.update({'port':22})174 self.config.update({'port':22})
175 # alternative ssh private key, identity file175 # parse ssh options for alternative ssh private key, identity file
176 m=re.search("-oidentityfile=(\S+)",globals.ssh_options,re.I)176 m=re.search("^(?:.+\s+)?(?:-oIdentityFile=|-i\s+)(([\"'])([^\\2]+)\\2|[\S]+).*",globals.ssh_options)
177 if (m!=None):177 if (m!=None):
178 keyfilename=m.group(1)178 keyfilename=m.group(3) if m.group(3) else m.group(1)
179 self.config['identityfile'] = keyfilename179 self.config['identityfile'] = keyfilename
180 # ensure ~ is expanded and identity exists in dictionary180 # ensure ~ is expanded and identity exists in dictionary
181 if 'identityfile' in self.config:181 if 'identityfile' in self.config:

Subscribers

People subscribed via source and target branches