X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fmethods%2Fremove_peer_object.py;h=41d74dc132858f93b870f17477fe0f44a9cb8f15;hb=d60510dd55bae2ee0169bd9ee5f36c99725ad167;hp=9ce272771409d5b1882d354517e3afaf6ce90c44;hpb=acae426433020998d0d45ed25584ebed0591d036;p=sfa.git diff --git a/sfa/methods/remove_peer_object.py b/sfa/methods/remove_peer_object.py index 9ce27277..41d74dc1 100644 --- a/sfa/methods/remove_peer_object.py +++ b/sfa/methods/remove_peer_object.py @@ -2,16 +2,14 @@ from sfa.util.faults import * from sfa.util.method import Method from sfa.util.parameter import Parameter, Mixed from sfa.trust.auth import Auth -from sfa.util.record import GeniRecord -from sfa.util.genitable import GeniTable -from sfa.util.debug import log +from sfa.util.record import SfaRecord +from sfa.util.table import SfaTable from sfa.trust.credential import Credential -from sfa.util.misc import * from types import StringTypes class remove_peer_object(Method): """ - Remove an peer object from the PLC records of a local aggregate. + Remove a peer object from the PLC records of a local aggregate. This method will be called by registry.remove() while removing a record from the local aggreage's PLCDB and sfa table. This method need not be directly called by end-user. @@ -28,7 +26,7 @@ class remove_peer_object(Method): Parameter(str, "Credential string"), Parameter(dict, "Record dictionary"), Mixed(Parameter(str, "Human readable name of the original caller"), - Paramater(None, "Origin hrn not specified")) + Parameter(None, "Origin hrn not specified")) ] returns = Parameter(int, "1 if successful") @@ -39,7 +37,7 @@ class remove_peer_object(Method): #log the call if not origin_hrn: origin_hrn = user_cred.get_gid_caller().get_hrn() - self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn, hrn, self.name)) + self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn, record['hrn'], self.name)) self.api.auth.check(cred, "remove") @@ -47,13 +45,13 @@ class remove_peer_object(Method): try: self.api.auth.verify_object_permission(record['hrn']) except: self.api.auth.verify_cred_is_me(cred) - table = GeniTable() + table = SfaTable() hrn, type = record['hrn'], record['type'] records = table.find({'hrn': hrn, 'type': type }) for record in records: - if record['peer_authority']: - self.remove_plc_record(record) - table.remove(record) + if record['peer_authority']: + self.remove_plc_record(record) + table.remove(record) return 1 @@ -89,14 +87,14 @@ class remove_peer_object(Method): self.api.plshell.DeleteSite(self.api.plauth, site['site_id']) else: - raise UnknownGeniType(type) + raise UnknownSfaType(type) return 1 def get_peer_name(self, peer_id): peers = self.api.plshell.GetPeers(self.api.plauth, [peer_id], ['peername', 'shortname', 'hrn_root']) if not peers: - raise GeniInvalidArgument, "No such peer" + raise SfaInvalidArgument, "No such peer" peer = peers[0] return peer['shortname']