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['tagname'] == 'codemux':
+ if attribute['name'] == 'codemux':
# add to conf. Attribute is [host, port]
params = {'host': attribute['value'].split(",")[0],
'port': attribute['value'].split(",")[1]}
def restartService():
logger.log("codemux: Restarting codemux service")
- os.system("/etc/init.d/codemux stop")
- f = os.popen("/sbin/pidof codemux")
- tmp = f.readlines()
- f.close()
- if len(tmp) > 0:
- pids = tmp[0].rstrip("\n").split()
- for pid in pids:
- logger.log("codemux: Killing stalled pid %s" % pid, 2)
- os.kill(pid, 9)
- os.system("/etc/init.d/codemux start")
+ os.system("/etc/init.d/codemux condrestart")