logger.log("codemux: plugin starting up...")
def GetSlivers(data, config, plc = None):
"""
logger.log("codemux: plugin starting up...")
def GetSlivers(data, config, plc = None):
"""
# Check if new or needs updating
if (sliver['name'] not in slicesinconf.keys()) \
or (params not in slicesinconf.get(sliver['name'], [])):
# Check if new or needs updating
if (sliver['name'] not in slicesinconf.keys()) \
or (params not in slicesinconf.get(sliver['name'], [])):
'''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...
'''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...
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():
if params['slice'] == "root": continue
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():
if params['slice'] == "root": continue
- f.write("%s %s %s\n" % (host, params['slice'], params['port']))
+ f.write("%s %s %s %s\n" % (host, params['slice'], params['port'], params['ip']))
dnames = {} # {host: slice}
for (slice, params) in slivers.iteritems():
for mapping in params:
dnames = {} # {host: slice}
for (slice, params) in slivers.iteritems():
for mapping in params:
def parseConf(conf = CODEMUXCONF):
'''Parse the CODEMUXCONF and return dict of slices in conf. {slice: (host,port)}'''
slicesinconf = {} # default
def parseConf(conf = CODEMUXCONF):
'''Parse the CODEMUXCONF and return dict of slices in conf. {slice: (host,port)}'''
slicesinconf = {} # default
logger.log("codemux: Restarting codemux service")
if isRunning():
logger.log_call(["/etc/init.d/codemux","condrestart", ])
else:
logger.log_call(["/etc/init.d/codemux","restart", ])
logger.log("codemux: Restarting codemux service")
if isRunning():
logger.log_call(["/etc/init.d/codemux","condrestart", ])
else:
logger.log_call(["/etc/init.d/codemux","restart", ])
if not isRunning():
logger.log("codemux: Starting codemux service")
logger.log_call(["/etc/init.d/codemux", "start", ])
if not isRunning():
logger.log("codemux: Starting codemux service")
logger.log_call(["/etc/init.d/codemux", "start", ])
if isRunning():
logger.log("codemux: Stopping codemux service")
logger.log_call(["/etc/init.d/codemux", "stop", ])
logger.log_call(["/sbin/chkconfig", "codemux", "off"])
if isRunning():
logger.log("codemux: Stopping codemux service")
logger.log_call(["/etc/init.d/codemux", "stop", ])
logger.log_call(["/sbin/chkconfig", "codemux", "off"])