X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fmethods%2FShutdown.py;h=e97738c0596882435f75630ad3dffa03a0766dd4;hb=236459c835ac05b2714458a7cfcd16840d80fc02;hp=f8e32942bbd1ba5f59f4a40d580e26a8600a6849;hpb=d9ab2d5930e31e1e5edb979bf96e66744934314b;p=sfa.git diff --git a/sfa/methods/Shutdown.py b/sfa/methods/Shutdown.py index f8e32942..e97738c0 100644 --- a/sfa/methods/Shutdown.py +++ b/sfa/methods/Shutdown.py @@ -1,10 +1,8 @@ -from sfa.util.faults import * -from sfa.util.namespace import * +from sfa.storage.parameter import Parameter +from sfa.trust.credential import Credential from sfa.util.method import Method -from sfa.util.parameter import Parameter -from sfa.methods.Stop import Stop -class Shutdown(Stop): +class Shutdown(Method): """ Perform an emergency shut down of a sliver. This operation is intended for administrative use. The sliver is shut down but remains available for further forensics. @@ -15,11 +13,16 @@ class Shutdown(Stop): interfaces = ['aggregate', 'slicemgr'] accepts = [ Parameter(str, "Slice URN"), - Parameter(type([str]), "List of credentials"), + Parameter(type([dict]), "Credentials"), ] returns = Parameter(bool, "Success or Failure") - def call(self, slice_xrn, creds): + def call(self, xrn, creds): - return Stop.call(self, slice_xrn, creds) + valid_creds = self.api.auth.checkCredentials(creds, 'stopslice', xrn) + #log the call + origin_hrn = Credential(cred=valid_creds[0]).get_gid_caller().get_hrn() + self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn, xrn, self.name)) + + return self.api.manager.Shutdown(self.api, xrn, creds)