fixed broken slice-creation
[nodemanager.git] / plugins / codemux.py
index 3852aa2..84b0f4e 100644 (file)
@@ -40,8 +40,11 @@ def GetSlivers(data, config, plc = None):
         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():
@@ -90,7 +93,7 @@ def writeConf(slivers, conf = CODEMUXCONF):
     f.truncate()
     f.close()
     try:  restartService()
-    except:  logger.log_exc()
+    except:  logger.log_exc("codemux.writeConf failed to restart service")
 
 
 def sortDomains(slivers):
@@ -126,7 +129,7 @@ def parseConf(conf = CODEMUXCONF):
             slicesinconf.setdefault(slice, [])
             slicesinconf[slice].append({"host": host, "port": port})
         f.close()
-    except IOError: logger.log_exc()
+    except IOError: logger.log_exc("codemux.parseConf got IOError")
     return slicesinconf