X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FDeleteInterface.py;h=229a0d7533b55f19e9c3e38c8e1872cc5adc914c;hb=79d959a7decd4af5b0b15e660bb3bd5bb5edfcaf;hp=307b3e08a5036e77e97c41a2a65ec753a8cb1905;hpb=286cdfc25f6ef8fd3e0ed59a175bcf801b14038a;p=plcapi.git diff --git a/PLC/Methods/DeleteInterface.py b/PLC/Methods/DeleteInterface.py index 307b3e0..229a0d7 100644 --- a/PLC/Methods/DeleteInterface.py +++ b/PLC/Methods/DeleteInterface.py @@ -1,4 +1,3 @@ -# $Id# from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed @@ -8,10 +7,10 @@ from PLC.Interfaces import Interface, Interfaces class DeleteInterface(Method): """ - Deletes an existing node network interface. + Deletes an existing interface. - Admins may delete any node network. PIs and techs may only delete - node network interfaces associated with nodes at their sites. + Admins may delete any interface. PIs and techs may only delete + interface interfaces associated with nodes at their sites. Returns 1 if successful, faults otherwise. """ @@ -20,7 +19,7 @@ class DeleteInterface(Method): accepts = [ Auth(), - Interface.fields['interface_id'] + Interface.fields['interface_id'] ] returns = Parameter(int, '1 if successful') @@ -28,31 +27,31 @@ class DeleteInterface(Method): def call(self, auth, interface_id): - # Get node network information + # Get interface information interfaces = Interfaces(self.api, [interface_id]) if not interfaces: - raise PLCInvalidArgument, "No such node network" - interface = interfaces[0] - - # Get node information - nodes = Nodes(self.api, [interface['node_id']]) - if not nodes: - raise PLCInvalidArgument, "No such node" - node = nodes[0] + raise PLCInvalidArgument, "No such interface %r"%interface_id + interface = interfaces[0] + + # Get node information + nodes = Nodes(self.api, [interface['node_id']]) + if not nodes: + raise PLCInvalidArgument, "No such node %r"%node_id + node = nodes[0] # Authenticated functino - assert self.caller is not None + assert self.caller is not None # If we are not an admin, make sure that the caller is a # member of the site at which the node is located. if 'admin' not in self.caller['roles']: if node['site_id'] not in self.caller['site_ids']: - raise PLCPermissionDenied, "Not allowed to delete this node network" + raise PLCPermissionDenied, "Not allowed to delete this interface" interface.delete() - # Logging variables - self.event_objects = {'Interface': [interface['interface_id']]} - self.message = "Node network %d deleted" % interface['interface_id'] + # Logging variables + self.event_objects = {'Interface': [interface['interface_id']]} + self.message = "Interface %d deleted" % interface['interface_id'] return 1