cleaned up imports
[sfa.git] / sfa / util / nodemanager.py
index ebf8408..1671b9d 100644 (file)
@@ -6,13 +6,17 @@ class NodeManager:
 
     method = None
 
+    def __init__(self, config):
+        self.config = config
+
     def __getattr__(self, method):
         self.method = method
         return self.__call__
     
     def __call__(self, *args):
         method = self.method
-        sfa_slice = "pl_genicw"
+        sfa_slice_prefix = self.config.SFA_CM_SLICE_PREFIX 
+        sfa_slice = sfa_slice_prefix + "_sfacm"
         python = "/usr/bin/python"
         vserver_path = "/vservers/%s" % (sfa_slice)
         script_path = "/tmp/"
@@ -33,12 +37,10 @@ print s.%(method)s%(args)s"""  % locals()
             f.close()
             # make the file executeable
             chmod_cmd = "/bin/chmod 775 %(filename)s" % locals()
-            print chmod_cmd
             (status, output) = commands.getstatusoutput(chmod_cmd)
 
             # execute the commad as a slice with root NM privs    
             cmd = 'su - %(sfa_slice)s -c "%(python)s %(scriptname)s"' % locals()
-            print cmd
             (status, output) = commands.getstatusoutput(cmd)
             return (status, output)  
         finally: os.unlink(filename)