[PATCH] BZR_HOSTKEYS.add instead of dict method (was: Re: problems with bzr 0.10 and paramiko sftp transfer)
Alexander Belchenko
bialix at ukr.net
Sat Nov 11 14:12:36 GMT 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Here is forgotten fix made by John Meinel in august (see history below).
There is also corresponding bug report: #70398.
I really don't know how to test this.
Corresponding branch: http://bialix.aaronbentley.com/paramiko.hostkeys/
Alexander
John Arbash Meinel пишет:
> 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
> =:->
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFVdpUzYr338mxwCURArRoAJ9xZwPFWcQ63r69inU+BbD6iCXc/ACfdCYF
SCp9S/e/o/tYVSmOS/Ztvik=
=R7C5
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: paramiko.hostkeys.add.patch
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20061111/33e58d54/attachment.diff
More information about the bazaar
mailing list