expects the 'interfaces' key in GetSlivers - review logs to always mention module
[nodemanager.git] / plugins / vsys.py
index 3effa58..ee806e7 100644 (file)
@@ -11,10 +11,15 @@ VSYSCONF="/etc/vsys.conf"
 VSYSBKEND="/vsys"
 
 def start(options, conf):
-    pass
+    logger.log("vsys: plugin starting up...")
 
-def GetSlivers(plc, data, config=None):
+def GetSlivers(data, config=None, plc=None):
     """For each sliver with the vsys attribute, set the script ACL, create the vsys directory in the slice, and restart vsys."""
+
+    if 'slivers' not in data:
+        logger.log_missing_data("vsys.GetSlivers",'slivers')
+        return
+
     # Touch ACLs and create dict of available
     scripts = {}
     for script in touchAcls(): scripts[script] = []
@@ -22,6 +27,9 @@ def GetSlivers(plc, data, config=None):
     slices = []
     _restart = False
     # Parse attributes and update dict of scripts
+    if 'slivers' not in data:
+        logger.log_missing_data("vsys.GetSlivers",'slivers')
+        return
     for sliver in data['slivers']:
         for attribute in sliver['attributes']:
             if attribute['tagname'] == 'vsys':
@@ -137,5 +145,5 @@ def parseConf():
             (path, slice) = line.split()
             slicesinconf.append(slice)
         f.close()
-    except: logger.log_exc()
+    except: logger.log_exc("vsys: failed parseConf")
     return slicesinconf