# HG changeset patch # User Edouard Tisserant # Date 1539861468 -7200 # Node ID e927c101ce6d60e4f08c06b9fbfc89e3d0fa6e96 # Parent 2eaf235270f888a683f9b3f88f9793ef2843f094 PYRO/TLSPSK : must use PYROLOC* protocol scheme in pyro URI, otherwise object ID is missing. Had to use more persuasive pyro3 monkey patching to have PYROLOCPSK resolved properly diff -r 2eaf235270f8 -r e927c101ce6d connectors/PYRO/PSK_Adapter.py --- a/connectors/PYRO/PSK_Adapter.py Thu Oct 18 11:01:14 2018 +0200 +++ b/connectors/PYRO/PSK_Adapter.py Thu Oct 18 13:17:48 2018 +0200 @@ -2,8 +2,10 @@ from __future__ import print_function import socket +import re import sslpsk import Pyro +from Pyro.core import PyroURI from Pyro.protocol import _connect_socket,TCPConnection,PYROAdapter from Pyro.errors import ConnectionDeniedError, ProtocolError from Pyro.util import Log @@ -45,8 +47,8 @@ self.conn=conn self.conn.connected=1 Log.msg('PYROAdapter','connected to',str(URI)) - if URI.protocol=='PYROLOC': - self.resolvePYROLOC_URI("PYRO") # updates self.URI + if URI.protocol=='PYROLOCPSK': + self.resolvePYROLOC_URI("PYROPSK") # updates self.URI elif msg[:len(self.denyMSG)]==self.denyMSG: try: raise ConnectionDeniedError(Pyro.constants.deniedReasons[int(msg[-1])]) @@ -64,3 +66,18 @@ Pyro.protocol.getProtocolAdapter = getProtocolAdapter +_processStringURI = Pyro.core.processStringURI +def processStringURI(URI): + x=re.match(r'(?PPYROLOCPSK)://(?P[^\s:]+):?(?P\d+)?/(?P\S*)',URI) + if x: + protocol=x.group('protocol') + hostname=x.group('hostname') + port=x.group('port') + if port: + port=int(port) + else: + port=0 + name=x.group('name') + return PyroURI(hostname,name,port,protocol) + return _processStringURI(URI) +Pyro.core.processStringURI = processStringURI diff -r 2eaf235270f8 -r e927c101ce6d connectors/PYRO/__init__.py --- a/connectors/PYRO/__init__.py Thu Oct 18 11:01:14 2018 +0200 +++ b/connectors/PYRO/__init__.py Thu Oct 18 13:17:48 2018 +0200 @@ -53,7 +53,7 @@ servicetype, location = uri.split("://") if servicetype == "PYROS": import connectors.PYRO.PSK_Adapter - schemename = "PYROPSK" + schemename = "PYROLOCPSK" url, ID = location.split('#') # load PSK from project secpath = os.path.join(str(confnodesroot.ProjectPath), 'psk', ID+'.secret')