예제 #1
0
파일: tasks.py 프로젝트: Tabrizian/swascale
def remove_from_cluster(cluster):
    cluster = db.clusters.find_one({'_id': ObjectId(cluster)})
    worker = None
    for vm in cluster['vms']:
        if vm['role'] == 'worker':
            worker = vm
            break

    if worker is not None:
        cluster['vms'].remove(worker)
        worker = Server(_id=worker['_id'])
        worker.swarm_leave()
        Server.delete(worker.uid)

        cluster = db.clusters.update_one({'_id': cluster['_id']}, {
            '$set': {
                'vms': cluster['vms']
            }
        })

        update_targets()
예제 #2
0
def delete(uid):
    Server.delete(uid)
    return 'deleted'