* Slices w/ initscripts were starting repeatedly because the flag that signals the...
[nodemanager.git] / codemux.py
index 1d907f7..ce69e4a 100644 (file)
@@ -16,7 +16,10 @@ def start(options, config):
 
 
 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()
@@ -30,7 +33,7 @@ def GetSlivers(data):
     # 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]}
@@ -51,8 +54,6 @@ def GetSlivers(data):
                 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
@@ -68,7 +69,11 @@ def writeConf(slivers, conf = CODEMUXCONF):
     '''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():