the build was failing here due to IndentationError
[sfa.git] / sfa / methods / redeem_ticket.py
1 ### $Id: reset_slice.py 15428 2009-10-23 15:28:03Z tmack $
2 ### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfacomponent/methods/reset_slice.py $
3 import xmlrpclib
4 from sfa.util.faults import *
5 from sfa.util.misc import *
6 from sfa.util.method import Method
7 from sfa.util.parameter import Parameter, Mixed
8
9 class redeem_ticket(Method):
10     """
11     Reset the specified slice      
12
13     @param cred credential string specifying the rights of the caller
14     @param ticket 
15     @return 1 is successful, faults otherwise  
16     """
17
18     interfaces = ['component']
19     
20     accepts = [
21         Parameter(str, "Credential string representation of SFA credential"),
22         Parameter(str, "Ticket  string representation of SFA ticket")
23         ]
24
25     returns = [Parameter(int, "1 if successful")]
26     
27     def call(self, cred, ticket):
28         self.api.auth.check(cred, 'redeemticket')
29         self.api.auth.check_ticket(ticket)
30
31         # send the call to the right manager
32         manager_base = 'sfa.managers'
33         mgr_type = self.api.config.SFA_CM_TYPE
34         manager_module = manager_base + ".component_manager_%s" % mgr_type
35         manager = __import__(manager_module, fromlist=[manager_base])
36         manager.redeem_ticket(self.api, ticket) 
37         return 1