~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/ssh.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-09-17 09:12:11 UTC
  • mfrom: (5430.1.2 merge-2.2-into-devel)
  • Revision ID: pqm@pqm.ubuntu.com-20100917091211-1e9h9nf6bsdjr6bd
(spiv) Merge lp:bzr/2.2, including fixes for #625574, #636930,
        #254278.

Show diffs side-by-side

added added

removed removed

Lines of Context:
336
336
            self._raise_connection_error(host, port=port, orig_error=e,
337
337
                                         msg='Unable to invoke remote bzr')
338
338
 
339
 
_ssh_connection_errors = (EOFError, OSError, IOError, socket.error)
340
339
if paramiko is not None:
341
340
    vendor = ParamikoVendor()
342
341
    register_ssh_vendor('paramiko', vendor)
343
342
    register_ssh_vendor('none', vendor)
344
343
    register_default_ssh_vendor(vendor)
345
 
    _ssh_connection_errors += (paramiko.SSHException,)
 
344
    _sftp_connection_errors = (EOFError, paramiko.SSHException)
346
345
    del vendor
 
346
else:
 
347
    _sftp_connection_errors = (EOFError,)
347
348
 
348
349
 
349
350
class SubprocessVendor(SSHVendor):
374
375
                                                  subsystem='sftp')
375
376
            sock = self._connect(argv)
376
377
            return SFTPClient(SocketAsChannelAdapter(sock))
377
 
        except _ssh_connection_errors, e:
 
378
        except _sftp_connection_errors, e:
 
379
            self._raise_connection_error(host, port=port, orig_error=e)
 
380
        except (OSError, IOError, socket.error), e:
 
381
            # If the machine is fast enough, ssh can actually exit
 
382
            # before we try and send it the sftp request, which
 
383
            # raises a Broken Pipe
 
384
            if e.errno not in (errno.EPIPE,):
 
385
                raise
378
386
            self._raise_connection_error(host, port=port, orig_error=e)
379
387
 
380
388
    def connect_ssh(self, username, password, host, port, command):
382
390
            argv = self._get_vendor_specific_argv(username, host, port,
383
391
                                                  command=command)
384
392
            return self._connect(argv)
385
 
        except _ssh_connection_errors, e:
 
393
        except (EOFError), e:
 
394
            self._raise_connection_error(host, port=port, orig_error=e)
 
395
        except (OSError, IOError, socket.error), e:
 
396
            # If the machine is fast enough, ssh can actually exit
 
397
            # before we try and send it the sftp request, which
 
398
            # raises a Broken Pipe
 
399
            if e.errno not in (errno.EPIPE,):
 
400
                raise
386
401
            self._raise_connection_error(host, port=port, orig_error=e)
387
402
 
388
403
    def _get_vendor_specific_argv(self, username, host, port, subsystem=None,