removing get_gid
[sfa.git] / sfa / methods / reboot.py
index a5e6f27..ae9e9b5 100644 (file)
@@ -2,7 +2,6 @@
 ### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfacomponent/methods/reboot.py $
 import os
 from sfa.util.faults import *
-from sfa.util.misc import *
 from sfa.util.method import Method
 from sfa.util.parameter import Parameter, Mixed
 
@@ -22,9 +21,12 @@ class reboot(Method):
 
     returns = None
     
-    def call(self, cred, request_hash=None):
-        client_gid = Credential(string=cred).get_gid_caller()
-        client_gid_str = client_gid.save_to_string(save_parents=True)
-        self.api.auth.authenticateGid(client_gid_str, [cred], request_hash)
+    def call(self, cred):
+        # validate the cred 
         self.api.auth.check(cred, 'reboot')
-        os.system("/sbin/reboot") 
+        # send the call to the right manager
+        manager_base = 'sfa.managers'
+        mgr_type = self.api.config.SFA_CM_TYPE
+        manager_module = manager_base + ".component_manager_%s" % mgr_type
+        manager = __import__(manager_module, fromlist=[manager_base])
+        manager.reboot()