forward config description with describe method
This commit is contained in:
@ -49,9 +49,13 @@ from secop.modules import Attached, Command, Done, Drivable, \
|
|||||||
from secop.protocol.dispatcher import make_update
|
from secop.protocol.dispatcher import make_update
|
||||||
|
|
||||||
|
|
||||||
CFG_HEADER = """[%(seaconn)s]
|
CFG_HEADER = """[NODE]
|
||||||
|
description = %(nodedescr)s
|
||||||
|
id = %(config)s.sea.psi.ch
|
||||||
|
|
||||||
|
[%(seaconn)s]
|
||||||
class = secop_psi.sea.SeaClient
|
class = secop_psi.sea.SeaClient
|
||||||
description = SEA connection to %(samenv)s
|
description = %(service)s sea connection for %(config)s
|
||||||
config = %(config)s
|
config = %(config)s
|
||||||
service = %(service)s
|
service = %(service)s
|
||||||
"""
|
"""
|
||||||
@ -270,8 +274,7 @@ class SeaClient(ProxyClient, Module):
|
|||||||
"""save objects (and sub-objects) description"""
|
"""save objects (and sub-objects) description"""
|
||||||
reply = self.request('describe_all')
|
reply = self.request('describe_all')
|
||||||
reply = ''.join('' if line.startswith('WARNING') else line for line in reply.split('\n'))
|
reply = ''.join('' if line.startswith('WARNING') else line for line in reply.split('\n'))
|
||||||
samenv, reply = json.loads(reply)
|
description, reply = json.loads(reply)
|
||||||
samenv = samenv.replace('/', '_')
|
|
||||||
modules = {}
|
modules = {}
|
||||||
modcls = {}
|
modcls = {}
|
||||||
for filename, obj, descr in reply:
|
for filename, obj, descr in reply:
|
||||||
@ -291,8 +294,8 @@ class SeaClient(ProxyClient, Module):
|
|||||||
service = SERVICE_NAMES[ext]
|
service = SERVICE_NAMES[ext]
|
||||||
seaconn = 'sea_' + service
|
seaconn = 'sea_' + service
|
||||||
with open(join(seaconfdir, stripped + '.cfg'), 'w') as fp:
|
with open(join(seaconfdir, stripped + '.cfg'), 'w') as fp:
|
||||||
fp.write(CFG_HEADER % dict(
|
fp.write(CFG_HEADER % dict(config=filename, seaconn=seaconn, service=service,
|
||||||
samenv=samenv, config=filename, seaconn=seaconn, service=service))
|
nodedescr=description.get(filename, filename)))
|
||||||
for obj in descr:
|
for obj in descr:
|
||||||
fp.write(CFG_MODULE % dict(modcls=modcls[obj], module=obj, seaconn=seaconn))
|
fp.write(CFG_MODULE % dict(modcls=modcls[obj], module=obj, seaconn=seaconn))
|
||||||
content = json.dumps(descr).replace('}, {', '},\n{')
|
content = json.dumps(descr).replace('}, {', '},\n{')
|
||||||
|
Reference in New Issue
Block a user