def DELETE(self): """Deletes a batch of nodes. Takes (JSONed) list of node ids to delete. :return: JSON-ed deletion task :http: * 200 (nodes have been succesfully deleted) * 202 (nodes are successfully scheduled for deletion) * 400 (data validation failed) * 404 (nodes not found in db) * 403 (on of the controllers is in error state) """ # TODO(pkaminski): web.py does not support parsing of array arguments # in the queryset so we specify the input as comma-separated list node_ids = self.checked_data( validate_method=self.validator.validate_collection_delete, data=web.input().get('ids', '') ) nodes = self.get_objects_list_or_404(self.collection, node_ids) task_manager = NodeDeletionTaskManager(cluster_id=nodes[0].cluster_id) # NOTE(aroma): ditto as in comments for NodeHandler's PUT method; try: task = task_manager.execute(nodes, mclient_remove=False) except errors.ControllerInErrorState as e: raise self.http(403, e.message) self.raise_task(task)
def DELETE(self, obj_id): """Deletes a node from DB and from Cobbler. :return: JSON-ed deletion task :http: * 200 (node has been succesfully deleted) * 202 (node is successfully scheduled for deletion) * 400 (data validation failed) * 404 (node not found in db) """ node = self.get_object_or_404(self.single, obj_id) task_manager = NodeDeletionTaskManager(cluster_id=node.cluster_id) task = task_manager.execute([node], mclient_remove=False) self.raise_task(task)
def DELETE(self, obj_id): """Deletes a node from DB and from Cobbler. :return: JSON-ed deletion task :http: * 200 (node has been succesfully deleted) * 202 (node is successfully scheduled for deletion) * 400 (data validation failed) * 404 (node not found in db) * 403 (on of the controllers is in error state) """ node = self.get_object_or_404(self.single, obj_id) task_manager = NodeDeletionTaskManager(cluster_id=node.cluster_id) try: task = task_manager.execute([node], mclient_remove=False) except errors.ControllerInErrorState as e: raise self.http(403, e.message) self.raise_task(task)
def DELETE(self): """Deletes a batch of nodes. Takes (JSONed) list of node ids to delete. :return: JSON-ed deletion task :http: * 200 (nodes have been succesfully deleted) * 202 (nodes are successfully scheduled for deletion) * 400 (data validation failed) * 404 (nodes not found in db) """ # TODO(pkaminski): web.py does not support parsing of array arguments # in the queryset so we specify the input as comma-separated list node_ids = self.checked_data( validate_method=self.validator.validate_collection_delete, data=web.input().get('ids', '')) nodes = self.get_objects_list_or_404(self.collection, node_ids) task_manager = NodeDeletionTaskManager(cluster_id=nodes[0].cluster_id) task = task_manager.execute(nodes, mclient_remove=False) self.raise_task(task)
def DELETE(self): """Deletes a batch of nodes. Takes (JSONed) list of node ids to delete. :return: JSON-ed deletion task :http: * 200 (nodes have been succesfully deleted) * 202 (nodes are successfully scheduled for deletion) * 400 (data validation failed) * 404 (nodes not found in db) """ # TODO(pkaminski): web.py does not support parsing of array arguments # in the queryset so we specify the input as comma-separated list node_ids = self.checked_data( validate_method=self.validator.validate_collection_delete, data=web.input().get("ids", "") ) nodes = self.get_objects_list_or_404(self.collection, node_ids) task_manager = NodeDeletionTaskManager(cluster_id=nodes[0].cluster_id) task = task_manager.execute(nodes, mclient_remove=False) self.raise_task(task)