瀏覽代碼

Removing part of wrapper that provides configuration for labkeyInterface and moving it to labkeyInterface/config.py

Andrej 1 周之前
父節點
當前提交
4082acf8a9
共有 1 個文件被更改,包括 0 次插入77 次删除
  1. 0 77
      src/nixWrapper/nixWrapper.py

+ 0 - 77
src/nixWrapper/nixWrapper.py

@@ -165,80 +165,3 @@ def updateSetup(name,path):
     with open(setupFile,'w') as f:
         json.dump(setup,f)
     
-def setConfig(labkeyUser,labkeyServer='https://merlin.fmf.uni-lj.si',\
-        certificateZip=None):
-    connectionConfig={}
-    if certificateZip!=None:
-        zpath=pathlib.Path(certificateZip)
-        user=zpath.stem
-        userDir=os.path.join(os.path.expanduser('~'),'.labkey',user)
-        if not os.path.isdir(userDir):
-            os.makedirs(userDir)
-        caName=None
-        with zipfile.ZipFile(certificateZip,'r') as zipObj:
-            zipObj.extract(user+'.crt',userDir)
-            zipObj.extract(user+'.key',userDir)
-            zipList=zipObj.namelist()
-            for f in zipList:
-                if f.find('CA')>-1:
-                    caName=f
-                    zipObj.extract(f,userDir)
-    
-        #setup SSL
-        sslSetup={}
-        sslSetup['user']=os.path.join(userDir,user+'.crt')
-        sslSetup['key']=os.path.join(userDir,user+'.key')
-        sslSetup['ca']=os.path.join(userDir,caName)
-        sslSetup['keyPwd']='notUsed'
-        connectionConfig['SSL']=sslSetup
-
-    connectionConfig["host"]=labkeyServer
-    connectionConfig["context"]="labkey"
-    labkeySetup={}
-    labkeySetup['user']=labkeyUser
-    labkeyPwd='guest'
-    if not labkeyUser=='guest':
-        labkeyPwd=getpass.getpass(prompt='Enter labkey password:')
-    labkeySetup['password']=labkeyPwd 
-    connectionConfig['labkey']=labkeySetup
-
-    orthancSetup={}
-    if connectionConfig['host'].find('merlin')>-1:
-        orthancSetup['server']='https://orthanc.fmf.uni-lj.si'
-    if connectionConfig['host'].find('onko-nix')>-1:
-        orthancSetup['server']='http://onko-nix.onko-i.si:8042'
-    orthancSetup['user']='ask'
-    orthancSetup['password']='askPassword'
-    connectionConfig['orthanc']=orthancSetup
-    net=labkeyInterface.labkeyInterface()
-    net.connectionConfig=connectionConfig
-    net.initRemote()
-    print(net.getUserId())
-    return net
-
-def testCertificate(certificateZip):
-    return setConfig('guest',certificateZip=certificateZip)
-
-def testConnection(labkeyUser,labkeyServer='https://merlin.fmf.uni-lj.si',\
-        certificateZip=None):
-    return setConfig(labkeyUser,labkeyServer,certificateZip)
-
-def getDefaultConfig(configFile):
-    #if configFile is None, this will set it to default and leave unchanged otherwise
-    if configFile==None:
-        return os.path.join(os.path.expanduser('~'),'.labkey','network.json')
-    return configFile
-
-def storeConfig(net,configFile=None):
-    #if configFile is None, this will set it to default and leave unchanged otherwise
-    with open(getDefaultConfig(configFile),'w') as f:
-        json.dump(net.connectionConfig,f,indent='\t')
-
-def getInterface(configFile=None):
-    net=labkeyInterface.labkeyInterface()
-    #if configFile is None, this will set it to default and leave unchanged otherwise
-    net.init(getDefaultConfig(configFile))
-    return net
-
-#loadLibrary('labkeyInterface')
-