git://git.onelab.eu
/
sfa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
taking out these two checks as discussed with tony. get_ticket is now a SM call,...
[sfa.git]
/
sfa
/
methods
/
get_ticket.py
diff --git
a/sfa/methods/get_ticket.py
b/sfa/methods/get_ticket.py
index
5121e83
..
62861e9
100644
(file)
--- a/
sfa/methods/get_ticket.py
+++ b/
sfa/methods/get_ticket.py
@@
-11,6
+11,7
@@
from sfa.util.genitable import GeniTable
from sfa.util.sfaticket import SfaTicket
from sfa.plc.slices import Slices
from sfatables.runtime import SFATablesRules
from sfa.util.sfaticket import SfaTicket
from sfa.plc.slices import Slices
from sfatables.runtime import SFATablesRules
+from sfa.util.rspec import *
class get_ticket(Method):
"""
class get_ticket(Method):
"""
@@
-41,11
+42,15
@@
class get_ticket(Method):
returns = Parameter(str, "String represeneation of a ticket object")
returns = Parameter(str, "String represeneation of a ticket object")
- def call(self, cred, hrn, rspec, request_hash=None):
+ def call(self, cred, hrn, rspec, request_hash=None
, origin_hrn=None
):
self.api.auth.authenticateCred(cred, [cred, hrn, rspec], request_hash)
self.api.auth.check(cred, "getticket")
self.api.auth.authenticateCred(cred, [cred, hrn, rspec], request_hash)
self.api.auth.check(cred, "getticket")
- self.api.auth.verify_object_belongs_to_me(hrn)
- self.api.auth.verify_object_permission(hrn)
+
+ if origin_hrn==None:
+ origin_hrn=Credential(string=cred).get_gid_caller().get_hrn()
+
+ #log the call
+ self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn, hrn, self.name))
# set the right outgoing rules
manager_base = 'sfa.managers'
# set the right outgoing rules
manager_base = 'sfa.managers'
@@
-65,18
+70,17
@@
class get_ticket(Method):
#incoming_rules.set_slice(hrn) # This is a temporary kludge. Eventually, we'd like to fetch the context requested by the match/target
contexts = incoming_rules.contexts
caller_hrn = Credential(string=cred).get_gid_caller().get_hrn()
#incoming_rules.set_slice(hrn) # This is a temporary kludge. Eventually, we'd like to fetch the context requested by the match/target
contexts = incoming_rules.contexts
caller_hrn = Credential(string=cred).get_gid_caller().get_hrn()
- request_context =
rspec_
manager.fetch_context(hrn, caller_hrn, contexts)
+ request_context = manager.fetch_context(hrn, caller_hrn, contexts)
incoming_rules.set_context(request_context)
rspec = incoming_rules.apply(rspec)
incoming_rules.set_context(request_context)
rspec = incoming_rules.apply(rspec)
-
# remove nodes that are not available at this interface from the rspec
# remove nodes that are not available at this interface from the rspec
- valid_rspec = RSpec(xml=manager.get_rspec(self.api))
+ valid_rspec = RSpec(xml=manager.get_rspec(self.api
, None, origin_hrn
))
valid_nodes = valid_rspec.getDictsByTagName('NodeSpec')
valid_nodes = valid_rspec.getDictsByTagName('NodeSpec')
- va
il
d_hostnames = [node['name'] for node in valid_nodes]
+ va
li
d_hostnames = [node['name'] for node in valid_nodes]
rspec_object = RSpec(xml=rspec)
rspec_object.filter(tagname='NodeSpec', attribute='name', whitelist=valid_hostnames)
rspec = rspec_object.toxml()
rspec_object = RSpec(xml=rspec)
rspec_object.filter(tagname='NodeSpec', attribute='name', whitelist=valid_hostnames)
rspec = rspec_object.toxml()
- ticket = manager.get_ticket(self.api, hrn, rspec)
+ ticket = manager.get_ticket(self.api, hrn, rspec
, origin_hrn
)
return ticket
return ticket