- returns = Parameter(int, '1 if successful')
-
- def call(self, auth, node_id_or_hostname, nodenetwork_id_or_hostname):
- # Get node network information
- nodenetworks = NodeNetworks(self.api, [nodenetwork_id_or_hostname]).values()
- if not nodenetworks:
- raise PLCInvalidArgument, "No such node network"
- nodenetwork = nodenetworks[0]
-
- # Get node information
- nodes = Nodes(self.api, [node_id_or_hostname]).values()
- if not nodes:
- raise PLCInvalidArgument, "No such node"
- node = nodes[0]
-
- # Check if node network is associated with specified node
- if not node['node_id'] == nodenetwork['node_id'] or nodenetwork['nodenetwork_id'] not in node['nodenetwork_ids']:
- raise PLCInvalidArgument, "node network not assoicated with this node"
-
- 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 node network at this node"
- if 'tech' not in self.caller['roles']:
- raise PLCPermissionDenied, "Not allowed to add node network for specified node"
- nodenetwork.delete()
-
- return 1
+ def call(self, auth, node_id_or_hostname, nodenetwork_id):
+ return DeleteNodeNetwork.call(self, auth, nodenetwork_id)