def delete(self): if request.method != 'POST': abort(405) if not self.node: abort(404) # XXX we need validation here # XXX WE REALLY NEED VALIDATION HERE try: delay = request.json.get('delay', 0) # simplejson.decoder.JSONDecodeError inherits from ValueError which is # the same that the builtin Python json handler will raise when no JSON # is passed in. except ValueError: delay = 0 if delay: delete_node.apply_async( (self.node.id,), countdown=delay) else: delete_provider_node( providers.get(self.node.provider), self.node.cloud_name ) delete_jenkins_node(self.node.jenkins_name) self.node.delete()
def delete_node(node_id): node = models.Node.get(node_id) if not node: logger.warning('async node deletion could not be completed') logger.warning('%s node id no longer exists', node_id) return util.delete_provider_node(providers.get(node.provider), node.cloud_name) util.delete_jenkins_node(node.jenkins_name) node.delete() models.commit()
def delete_node(node_id): node = models.Node.get(node_id) if not node: logger.warning('async node deletion could not be completed') logger.warning('%s node id no longer exists', node_id) return util.delete_provider_node( providers.get(node.provider), node.cloud_name ) util.delete_jenkins_node(node.jenkins_name) node.delete() models.commit()