コード例 #1
0
 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()
コード例 #2
0
ファイル: nodes.py プロジェクト: ceph/mita
 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()
コード例 #3
0
ファイル: tasks.py プロジェクト: vasukulkarni/mita
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()
コード例 #4
0
ファイル: tasks.py プロジェクト: ErwanAliasr1/mita
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()