From: Anil-Kumar Vengalil Date: Wed, 23 Sep 2009 14:25:47 +0000 (+0000) Subject: connecting the remove_remote_object method to registry.remove() X-Git-Tag: sfa-0.9-3~49 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=9f59853888b1649c74f7acb15d8828ad6da7dba9;p=sfa.git connecting the remove_remote_object method to registry.remove() --- diff --git a/sfa/methods/remove.py b/sfa/methods/remove.py index dab6bf30..b56cc502 100644 --- a/sfa/methods/remove.py +++ b/sfa/methods/remove.py @@ -9,6 +9,7 @@ from sfa.util.record import GeniRecord from sfa.util.genitable import GeniTable from sfa.util.debug import log from sfa.trust.credential import Credential +from sfa.server.registry import Registries class remove(Method): """ @@ -48,8 +49,16 @@ class remove(Method): if not records: raise RecordNotFound(hrn) record = records[0] - type = record['type'] + + credential = self.api.getCredential() + registries = Registries(self.api) + # Try to remove the object from the PLCDB of federated agg. + # This is attempted before removing the object from the local agg's PLCDB and sfa table + if hrn.startswith(self.api.hrn) and type in ['user', 'slice', 'authority']: + for registry in registries: + if registry not in [self.api.hrn]: + result=registries[registry].remove_remote_object(credential, hrn, record) if type == "user": persons = self.api.plshell.GetPersons(self.api.plauth, record['pointer']) # only delete this person if he has site ids. if he doesnt, it probably means @@ -69,5 +78,7 @@ class remove(Method): raise UnknownGeniType(type) table.remove(record) + + # forward the call after replacing the root hrn return 1 diff --git a/sfa/util/geniclient.py b/sfa/util/geniclient.py index cbddf919..3bc00126 100644 --- a/sfa/util/geniclient.py +++ b/sfa/util/geniclient.py @@ -345,3 +345,6 @@ class GeniClient: return result + def remove_remote_object(self, cred, hrn, record): + result = self.server.remove_remote_object(cred.save_to_string(save_parents=True), hrn, record) + return result