Re: Some questions

Irmen de Jong <[email protected]> Thu, 11 Dec 2014 23:25:27 +0100
Newsgroups gmane.comp.python.pyro
Message-ID <[email protected]>
On 13-11-2014 0:06, Bzzzz wrote:

> On Wed, 12 Nov 2014 22:30:42 +0100
> Bzzzz <[email protected]> wrote:
> 
> Hmmm, same issue with resolve():
> 
> code block:
> -----------
> # With conf_cli.NS_REGISTERED_NAME = u"PYRONAME:rpc.server"
> 
> DB = Pyro4.naming.resolve( conf_cli.NS_REGISTERED_NAME,
>     conf_cli.HMAC_KEY ) 
> DB._pyroHmacKey = conf_cli.HMAC_KEY
> 
> result:
> -------
> Traceback (most recent call last):
>   File "./client_rpcusers_010.py", line 150, in <module>
>     DB = Pyro4.naming.resolve( conf_cli.NS_REGISTERED_NAME,
> conf_cli.HMAC_KEY ) File
> "/usr/local/lib/python2.7/dist-packages/Pyro4-4.30-py2.7.egg/Pyro4/naming.py",
> line 440, in resolve uri = nameserver.lookup(uri.object) File
> "/usr/local/lib/python2.7/dist-packages/Pyro4-4.30-py2.7.egg/Pyro4/core.py",
> line 231, in __getattr__ self._pyroGetMetadata() File
> "/usr/local/lib/python2.7/dist-packages/Pyro4-4.30-py2.7.egg/Pyro4/core.py",
> line 475, in _pyroGetMetadata self.__pyroCreateConnection() File
> "/usr/local/lib/python2.7/dist-packages/Pyro4-4.30-py2.7.egg/Pyro4/core.py",
> line 441, in __pyroCreateConnection raise ce
> Pyro4.errors.CommunicationError: cannot connect: hmac key config not
> symmetric


The problem was in Pyro's locateNS function. When it discovered the name server via a
broadcast lookup, it returned a proxy without setting the proper hmac key. (It worked
fine when it found the NS via other means).

Also your call to resolve() is fine -where you provided the hmac_key- but it uses
locateNS() internally and so failed in the same fashion as your original code.


I've committed the fix for this, but you'll have to make a minor change to your original
code as well: make sure that you pass in a hmac_key to the locateNS() function. If you
do this, you will receive back a proxy that has the correct hmac key already set (so you
don't have to set its _pyroHmacKey property yourself anymore).
You do have to set it on any new proxies you create because Pyro will not remember the
secret key anywhere.

Can you try out the current MASTER version in Github with the above mentioned little
change in your code, and report back if this solves your issue? I will then make it an
official release.



Irmen


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk