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
|
||||
|
||||
|
||||
CFG_HEADER = """[%(seaconn)s]
|
||||
CFG_HEADER = """[NODE]
|
||||
description = %(nodedescr)s
|
||||
id = %(config)s.sea.psi.ch
|
||||
|
||||
[%(seaconn)s]
|
||||
class = secop_psi.sea.SeaClient
|
||||
description = SEA connection to %(samenv)s
|
||||
description = %(service)s sea connection for %(config)s
|
||||
config = %(config)s
|
||||
service = %(service)s
|
||||
"""
|
||||
@ -270,8 +274,7 @@ class SeaClient(ProxyClient, Module):
|
||||
"""save objects (and sub-objects) description"""
|
||||
reply = self.request('describe_all')
|
||||
reply = ''.join('' if line.startswith('WARNING') else line for line in reply.split('\n'))
|
||||
samenv, reply = json.loads(reply)
|
||||
samenv = samenv.replace('/', '_')
|
||||
description, reply = json.loads(reply)
|
||||
modules = {}
|
||||
modcls = {}
|
||||
for filename, obj, descr in reply:
|
||||
@ -291,8 +294,8 @@ class SeaClient(ProxyClient, Module):
|
||||
service = SERVICE_NAMES[ext]
|
||||
seaconn = 'sea_' + service
|
||||
with open(join(seaconfdir, stripped + '.cfg'), 'w') as fp:
|
||||
fp.write(CFG_HEADER % dict(
|
||||
samenv=samenv, config=filename, seaconn=seaconn, service=service))
|
||||
fp.write(CFG_HEADER % dict(config=filename, seaconn=seaconn, service=service,
|
||||
nodedescr=description.get(filename, filename)))
|
||||
for obj in descr:
|
||||
fp.write(CFG_MODULE % dict(modcls=modcls[obj], module=obj, seaconn=seaconn))
|
||||
content = json.dumps(descr).replace('}, {', '},\n{')
|
||||
|
Reference in New Issue
Block a user