2 from sfa.util.faults import *
3 from sfa.util.method import Method
4 from sfa.util.parameter import Parameter, Mixed
5 from sfa.trust.credential import Credential
9 Update an object in the registry. Currently, this only updates the
10 PLC information associated with the record. The SFA fields (name, type,
13 @param cred credential string specifying rights of the caller
14 @param record a record dictionary to be updated
16 @return 1 if successful, faults otherwise
19 interfaces = ['registry']
22 Parameter(dict, "Record dictionary to be updated"),
23 Parameter(str, "Credential string"),
26 returns = Parameter(int, "1 if successful")
28 def call(self, record_dict, creds):
30 valid_creds = self.api.auth.checkCredentials(creds, "update")
33 hrn = record_dict.get('hrn', '')
34 self.api.auth.verify_object_permission(hrn)
37 origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn()
38 self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn, hrn, self.name))
40 manager = self.api.get_interface_manager()
42 return manager.update(self.api, record_dict)