1 ### $Id: update.py 16477 2010-01-05 16:31:37Z thierry $
2 ### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/methods/update.py $
5 from sfa.util.faults import *
6 from sfa.util.method import Method
7 from sfa.util.parameter import Parameter, Mixed
8 from sfa.trust.credential import Credential
12 Update an object in the registry. Currently, this only updates the
13 PLC information associated with the record. The SFA fields (name, type,
16 @param cred credential string specifying rights of the caller
17 @param record a record dictionary to be updated
19 @return 1 if successful, faults otherwise
22 interfaces = ['registry']
25 Parameter(dict, "Record dictionary to be updated"),
26 Parameter(str, "Credential string"),
29 returns = Parameter(int, "1 if successful")
31 def call(self, record_dict, creds):
33 valid_creds = self.api.auth.checkCredentials(creds, "update")
34 origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn()
35 self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn, None, self.name))
37 manager = self.api.get_interface_manager()
39 return manager.update(self.api, record_dict)