passing the hrn of the initial caller instead of its credentail
[sfa.git] / sfacomponent / methods / reset_slice.py
index fa26e99..9a1f8e4 100644 (file)
@@ -1,5 +1,5 @@
-### $Id: start_slice.py 15428 2009-10-23 15:28:03Z tmack $
-### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/methods/start_slice.py $
+### $Id: reset_slice.py 15428 2009-10-23 15:28:03Z tmack $
+### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfacomponent/methods/reset_slice.py $
 
 from sfa.util.faults import *
 from sfa.util.misc import *
@@ -8,7 +8,7 @@ from sfa.util.parameter import Parameter, Mixed
 
 class reset_slice(Method):
     """
-    Start the specified slice      
+    Reset the specified slice      
 
     @param cred credential string specifying the rights of the caller
     @param hrn human readable name of slice to instantiate
@@ -33,11 +33,11 @@ class reset_slice(Method):
         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, hrn], request_hash)
-        self.api.auth.check(cred, 'startslice')
+        self.api.auth.check(cred, 'resetslice')
+        slicename = hrn_to_pl_slicename(hrn)
+        if not self.api.sliver_exists(slicename):
+            raise SliverDoesNotExist(slicename)
 
-        if not self.api.sliver_exists(hrn):
-            raise SliverDoesNotExist(hrn)
-
-        self.api.nodemanager.ReCreate(hrn)
+        self.api.nodemanager.ReCreate(slicename)
         
         return 1