problems with bzr 0.10 and paramiko sftp transfer

Robey Pointer robey at lag.net
Wed Aug 30 03:34:55 BST 2006


On 29 Aug 2006, at 8:41, John Arbash Meinel wrote:

> 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?

I think the first version with the HostKeys class is 1.5.3.  And your  
workaround looks good to me.

robey





More information about the bazaar mailing list