connectors/PYRO/__init__.py
changeset 2339 48b4eba13064
parent 2338 2c3222433244
child 2429 15f18dc8b56a
--- a/connectors/PYRO/__init__.py	Mon Nov 19 10:39:50 2018 +0100
+++ b/connectors/PYRO/__init__.py	Tue Nov 20 11:32:42 2018 +0100
@@ -36,6 +36,7 @@
 import Pyro.util
 from Pyro.errors import PyroError
 
+import PSKManagement as PSK
 
 zeroconf_service_type = '_PYRO._tcp.local.'
 # this module attribute contains a list of DNS-SD (Zeroconf) service types
@@ -124,14 +125,8 @@
         confnodesroot.logger.write_error(_("Cannot get PLC ID - connection failed.\n"))
         return None
 
-    if scheme != "PYROS":
-        ID,PSK = IDPSK
-        secdir = os.path.join(str(confnodesroot.ProjectPath), 'psk')
-        if not os.path.exists(secdir):
-            os.mkdir(secdir)
-        secpath = os.path.join(secdir, ID+'.secret')
-        with open(secpath, 'w') as f:
-            f.write(ID+":"+PSK)
+    ID,secret = IDPSK
+    PSK.UpdateID(confnodesroot.ProjectPath, ID, secret, uri)
 
     _special_return_funcs = {
         "StartPLC": False,
@@ -145,6 +140,7 @@
         A proxy proxy class to handle Beremiz Pyro interface specific behavior.
         And to put Pyro exception catcher in between caller and Pyro proxy
         """
+
         def __getattr__(self, attrName):
             member = self.__dict__.get(attrName, None)
             if member is None: