adding support for geni_speaking_for option
[sfa.git] / sfa / methods / CreateSliver.py
index b28d1a5..bc9bf96 100644 (file)
@@ -2,7 +2,6 @@ from sfa.util.faults import SfaInvalidArgument, InvalidRSpec
 from sfa.util.xrn import urn_to_hrn
 from sfa.util.method import Method
 from sfa.util.sfatablesRuntime import run_sfatables
-import sys
 from sfa.trust.credential import Credential
 from sfa.storage.parameter import Parameter, Mixed
 from sfa.rspecs.rspec import RSpec
@@ -34,14 +33,16 @@ class CreateSliver(Method):
         hrn, type = urn_to_hrn(slice_xrn)
 
         self.api.logger.info("interface: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, hrn, self.name))
-        print >>sys.stderr, " \r\n \r\n Createsliver.py call %s\ttarget-hrn: %s\tmethod-name: %s "%(self.api.interface, hrn, self.name)
+
+        (speaking_for, _) = urn_to_hrn(options.get('geni_speaking_for'))
+    
         # Find the valid credentials
-        valid_creds = self.api.auth.checkCredentials(creds, 'createsliver', hrn)
+        valid_creds = self.api.auth.checkCredentials(creds, 'createsliver', hrn, speaking_for)
         origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn()
 
         # make sure users info is specified
         if not users:
-            msg = "'users' musst be specified and cannot be null. You may need to update your client." 
+            msg = "'users' must be specified and cannot be null. You may need to update your client." 
             raise SfaInvalidArgument(name='users', extra=msg)  
 
         # flter rspec through sfatables