def GetSlivers(data):
- """For each sliver with the codemux attribute, parse out "host,port" and make entry in conf. Restart service after."""
+ """
+ For each sliver with the codemux attribute, parse out "host,port"
+ and make entry in conf. Restart service after.
+ """
logger.log("codemux: Starting.", 2)
# slices already in conf
slicesinconf = parseConf()
# Parse attributes and update dict of scripts
for sliver in data['slivers']:
for attribute in sliver['attributes']:
- if attribute['name'] == 'codemux':
+ if attribute['tagname'] == 'codemux':
# add to conf. Attribute is [host, port]
params = {'host': attribute['value'].split(",")[0],
'port': attribute['value'].split(",")[1]}
except:
logger.log("codemux: sliver %s not running yet. Deferring."\
% sliver['name'])
-
- logger.log_exc(name = "codemux")
pass
# Remove slices from conf that no longer have the attribute
'''Write conf with default entry up top. Elements in [] should have lower order domain names first. Restart service.'''
f = open(conf, "w")
# This needs to be the first entry...
- f.write("* root 1080 %s\n" % Config().PLC_PLANETFLOW_HOST)
+ try:
+ f.write("* root 1080 %s\n" % Config().PLC_PLANETFLOW_HOST)
+ except AttributeError:
+ logger.log("codemux: Can't find PLC_CONFIG_HOST in config. Using PLC_API_HOST")
+ f.write("* root 1080 %s\n" % Config().PLC_API_HOST)
# Sort items for like domains
for mapping in slivers:
for (host, params) in mapping.iteritems():