Setting tag NodeManager-1.8-19
[nodemanager.git] / plugins / codemux.py
index b367b58..fa5311f 100644 (file)
@@ -14,7 +14,7 @@ CODEMUXCONF="/etc/codemux/codemux.conf"
 def start(options, conf):
     logger.log("codemux plugin starting up...")
 
-def GetSlivers(plc, data, config):
+def GetSlivers(data, config, plc = None):
     """
     For each sliver with the codemux attribute, parse out "host,port" 
     and make entry in conf.  Restart service after.
@@ -40,8 +40,11 @@ def GetSlivers(plc, data, config):
         for attribute in sliver['attributes']:
             if attribute['tagname'] == 'codemux':
                 # add to conf.  Attribute is [host, port]
-                params = {'host': attribute['value'].split(",")[0], 
-                          'port': attribute['value'].split(",")[1]}
+                parts = attribute['value'].split(",")
+                if len(parts)<2:
+                    logger.log("codemux: attribute value (%s) for codemux not separated by comma. Skipping."%attribute['value'])
+                    continue
+                params = {'host': parts[0], 'port': parts[1]}
                 try:
                     # Check to see if sliver is running.  If not, continue
                     if vserver.VServer(sliver['name']).is_running():