~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/ssh.py

  • Committer: Patch Queue Manager
  • Date: 2015-10-05 13:45:00 UTC
  • mfrom: (6603.3.1 bts794146)
  • Revision ID: pqm@pqm.ubuntu.com-20151005134500-v244rho557tv0ukd
(vila) Resolve Bug #1480015: Test failure: hexify removed from paramiko
 (Andrew Starr-Bochicchio) (Andrew Starr-Bochicchio)

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
import socket
27
27
import subprocess
28
28
import sys
 
29
from binascii import hexlify
29
30
 
30
31
from bzrlib import (
31
32
    config,
276
277
class ParamikoVendor(SSHVendor):
277
278
    """Vendor that uses paramiko."""
278
279
 
 
280
    def _hexify(self, s):
 
281
        return hexlify(s).upper()
 
282
 
279
283
    def _connect(self, username, password, host, port):
280
284
        global SYSTEM_HOSTKEYS, BZR_HOSTKEYS
281
285
 
289
293
            self._raise_connection_error(host, port=port, orig_error=e)
290
294
 
291
295
        server_key = t.get_remote_server_key()
292
 
        server_key_hex = paramiko.util.hexify(server_key.get_fingerprint())
 
296
        server_key_hex = self._hexify(server_key.get_fingerprint())
293
297
        keytype = server_key.get_name()
294
298
        if host in SYSTEM_HOSTKEYS and keytype in SYSTEM_HOSTKEYS[host]:
295
299
            our_server_key = SYSTEM_HOSTKEYS[host][keytype]
296
 
            our_server_key_hex = paramiko.util.hexify(
297
 
                our_server_key.get_fingerprint())
 
300
            our_server_key_hex = self._hexify(our_server_key.get_fingerprint())
298
301
        elif host in BZR_HOSTKEYS and keytype in BZR_HOSTKEYS[host]:
299
302
            our_server_key = BZR_HOSTKEYS[host][keytype]
300
 
            our_server_key_hex = paramiko.util.hexify(
301
 
                our_server_key.get_fingerprint())
 
303
            our_server_key_hex = self._hexify(our_server_key.get_fingerprint())
302
304
        else:
303
305
            trace.warning('Adding %s host key for %s: %s'
304
306
                          % (keytype, host, server_key_hex))
308
310
            else:
309
311
                BZR_HOSTKEYS.setdefault(host, {})[keytype] = server_key
310
312
            our_server_key = server_key
311
 
            our_server_key_hex = paramiko.util.hexify(
312
 
                our_server_key.get_fingerprint())
 
313
            our_server_key_hex = self._hexify(our_server_key.get_fingerprint())
313
314
            save_host_keys()
314
315
        if server_key != our_server_key:
315
316
            filename1 = os.path.expanduser('~/.ssh/known_hosts')
505
506
        agent = paramiko.Agent()
506
507
        for key in agent.get_keys():
507
508
            trace.mutter('Trying SSH agent key %s'
508
 
                         % paramiko.util.hexify(key.get_fingerprint()))
 
509
                         % self._hexify(key.get_fingerprint()))
509
510
            try:
510
511
                paramiko_transport.auth_publickey(username, key)
511
512
                return