problems with bzr 0.10 and paramiko sftp transfer

John Arbash Meinel john at arbash-meinel.com
Tue Aug 29 16:41:05 BST 2006


Lukáš Lalinský wrote:
> Lukáš Lalinský wrote:
>> Hi,
>>
>> When I tried to run "bzr push" with bzr 0.10 and paramiko 1.6, I get:
>>
> [...]
>> AttributeError: HostKeys instance has no attribute '__setitem__'
>>
>> I upgraded to 1.6.2, where this method was added (with a comment "don't use this
>> please."), but appears to be broken:
>>
> [...]
>> AttributeError: HostKeys instance has no attribute '_keys'
>>
>> So my question is, is there a known version of paramiko that works with bzr 0.10?
> 
> Ok, so it seems like paramiko changed the API, and nobody had chance to test
> adding a new host key using it :)
> 
> The second error is obviously a paramiko bug, but still it would be nice to use
> the new API instead of accessing the dict-like object. There is a simple patch
> in the attachment to fix this.
> 
> -Lukáš

I think the problem is that most of us don't use paramiko as the SSH
transport (we normally spawn a real 'ssh' process, which handles keys on
its own).

My biggest concern is that if paramiko is changing the API, then we have
to be aware of which version of paramiko we are using, so that we use
the correct api. (we can't just call BZR_HOSTKEYS.add() if that api
doesn't exist).

So I'll try to look into the paramiko history, and see if we can come up
with a compatible solution.

My best guess is that we would end up doing:

add = getattr(BZR_HOSTKEYS, 'add', None)
if add is not None: # paramiko >= 1.X.X
  BZR_HOSTKEYS.add(self._host, keytype, server_key)
else:
  BZR_HOSTKEYS.set_default(self._host, {})[keytype] = server_key

Robey-
As the creator of paramiko, can you save me some time by letting me know
when the paramiko api changed? (Was it between 1.5.X and 1.6?) And if my
fix is appropriate?

John
=:->


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060829/edcbea22/attachment.pgp 


More information about the bazaar mailing list