use different names for seaconn in different frappy services
This commit is contained in:
parent
a5cc98d0b0
commit
331dc544ad
@ -48,20 +48,26 @@ from secop.modules import Attached, Command, Done, Drivable, \
|
||||
Module, Parameter, Property, Readable, Writable
|
||||
from secop.protocol.dispatcher import make_update
|
||||
|
||||
CFG_HEADER = """[seaconn]
|
||||
|
||||
CFG_HEADER = """[%(seaconn)s]
|
||||
class = secop_psi.sea.SeaClient
|
||||
description = SEA connection to %(samenv)s
|
||||
config = %(config)s
|
||||
%(export)s
|
||||
service = %(service)s
|
||||
"""
|
||||
|
||||
CFG_MODULE = """
|
||||
[%(module)s]
|
||||
class = secop_psi.sea.%(modcls)s
|
||||
iodev = seaconn
|
||||
iodev = %(seaconn)s
|
||||
sea_object = %(module)s
|
||||
"""
|
||||
|
||||
SERVICE_NAMES = {
|
||||
'config': 'main',
|
||||
'stick': 'stick',
|
||||
'addon': 'addons',
|
||||
}
|
||||
|
||||
SEA_DIR = expanduser('~/sea')
|
||||
for confdir in getGeneralConfig()['confdir'].split(os.pathsep):
|
||||
@ -281,12 +287,14 @@ class SeaClient(ProxyClient, Module):
|
||||
|
||||
result = []
|
||||
for filename, descr in modules.items():
|
||||
stripped = filename.rpartition('.')[0]
|
||||
stripped, _, ext = filename.rpartition('.')
|
||||
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,
|
||||
export='' if filename.endswith('.config') else 'export=False'))
|
||||
fp.write(CFG_HEADER % dict(
|
||||
samenv=samenv, config=filename, seaconn=seaconn, service=service))
|
||||
for obj in descr:
|
||||
fp.write(CFG_MODULE % dict(modcls=modcls[obj], module=obj))
|
||||
fp.write(CFG_MODULE % dict(modcls=modcls[obj], module=obj, seaconn=seaconn))
|
||||
content = json.dumps(descr).replace('}, {', '},\n{')
|
||||
with open(join(seaconfdir, filename + '.json'), 'w') as fp:
|
||||
fp.write(content + '\n')
|
||||
|
Loading…
x
Reference in New Issue
Block a user