~ed.so/duplicity/paramiko.identyfile

« back to all changes in this revision

Viewing changes to duplicity/backends/ssh_paramiko_backend.py

  • Committer: ede
  • Date: 2014-12-10 19:09:28 UTC
  • Revision ID: ede-20141210190928-qhb0k19ry3szc10m
fix identity file parsing of --ssh-options for paramiko
manpage fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
172
172
            self.config.update({'port':int(self.config['port'])})
173
173
        else:
174
174
            self.config.update({'port':22})
175
 
        # alternative ssh private key, identity file
176
 
        m=re.search("-oidentityfile=(\S+)",globals.ssh_options,re.I)
 
175
        # parse ssh options for alternative ssh private key, identity file
 
176
        m=re.search("^(?:.+\s+)?(?:-oIdentityFile=|-i\s+)(([\"'])([^\\2]+)\\2|[\S]+).*",globals.ssh_options)
177
177
        if (m!=None):
178
 
            keyfilename=m.group(1)
 
178
            keyfilename=m.group(3) if m.group(3) else m.group(1)
179
179
            self.config['identityfile'] = keyfilename
180
180
        # ensure ~ is expanded and identity exists in dictionary
181
181
        if 'identityfile' in self.config: