X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fmethods%2FShutdown.py;h=8641bd0e6542aff5ddaca06ae41d54ec996aec60;hb=1cc8e9613cab8b5b22478de369f259e591c54e6d;hp=9788608a7468dd60fc55d62f4c1a32b8194d6d8e;hpb=14ca7e52f6af8accc0ba6e362e2a674ea4579e7f;p=sfa.git diff --git a/sfa/methods/Shutdown.py b/sfa/methods/Shutdown.py index 9788608a..8641bd0e 100644 --- a/sfa/methods/Shutdown.py +++ b/sfa/methods/Shutdown.py @@ -1,7 +1,8 @@ -from sfa.util.parameter import Parameter -from sfa.methods.Stop import Stop +from sfa.storage.parameter import Parameter +from sfa.trust.credential import Credential +from sfa.util.method import Method -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. @@ -12,11 +13,17 @@ 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, + check_sliver_callback = self.api.manager.driver.check_sliver_credentials) + #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)