using the correct root_ssh_key to reach the node
[sfa.git] / sfa / methods / reboot.py
1 ### $Id: reboot.py 15428 2009-10-23 15:28:03Z tmack $
2 ### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfacomponent/methods/reboot.py $
3 import os
4 from sfa.util.faults import *
5 from sfa.util.method import Method
6 from sfa.util.parameter import Parameter, Mixed
7
8 class reboot(Method):
9     """
10     Reboot the component       
11
12     @param cred credential string specifying the rights of the caller
13     @return None  
14     """
15
16     interfaces = ['component']
17     
18     accepts = [
19         Parameter(str, "Credential string"),
20         ]
21
22     returns = None
23     
24     def call(self, cred):
25         # validate the cred 
26         self.api.auth.check(cred, 'reboot')
27         # send the call to the right manager
28         manager_base = 'sfa.managers'
29         mgr_type = self.api.config.SFA_CM_TYPE
30         manager_module = manager_base + ".component_manager_%s" % mgr_type
31         manager = __import__(manager_module, fromlist=[manager_base])
32         manager.reboot()