예제 #1
0
def provision_baremetal_allocation():
    bmdb = BaremetalDB()
    method = request.method.lower()
    if method in ['get']:
        request_users = get_all_baremetal_request_users()
        baremetal_computers = bmdb.get_baremetal_computers()
        print "baremetal computers: ", baremetal_computers
        return render_template("mesh/provision/provision_main.html",
                               users=request_users,
                               computers=baremetal_computers["idle"],
                               flag_idle=True,
                               )
    elif method in ['put']:
        data = request.json
        result = bmdb.assign_baremetal_to_user(data["computers"], data["user"])
        return Response(json.dumps({"result": result}), status=200, mimetype="application/json")
예제 #2
0
def provision_baremetal_allocation():
    bmdb = BaremetalDB()
    method = request.method.lower()
    if method in ['get']:
        request_users = get_all_baremetal_request_users()
        baremetal_computers = bmdb.get_baremetal_computers()
        print "baremetal computers: ", baremetal_computers
        return render_template("mesh/provision/provision_main.html",
                               users=request_users,
                               computers=baremetal_computers["idle"],
                               flag_idle=True,
                               )
    elif method in ['put']:
        data = request.json
        result = bmdb.assign_baremetal_to_user(data["computers"], data["user"])
        return Response(json.dumps({"result": result}), status=200, mimetype="application/json")
예제 #3
0
파일: cobbler.py 프로젝트: nbohn/cloudmesh
def baremetal_user_requests():
    bmdb = BaremetalDB()
    method = request.method.lower()
    if method in ["get"]:
        get_result = bmdb.get_baremetal_computers()
        baremetal_computers = get_result["used"]
        bm_computer_info = {}
        for cluster in baremetal_computers:
            bm_computer_info[cluster] = {}
            for bm_comp in baremetal_computers[cluster]:
                bm_computer_info[cluster][bm_comp] = bmdb.get_baremetal_computer_detail(bm_comp)
        return render_template(
            "mesh/provision/provision_main.html",
            computers=baremetal_computers,
            computer_info=bm_computer_info,
            flag_idle=False,
        )
    elif method in ["put"]:
        data = request.json
        result = bmdb.withdraw_baremetal_from_user(data["computers"])
        return Response(json.dumps({"result": result}), status=200, mimetype="application/json")
예제 #4
0
def baremetal_user_requests():
    bmdb = BaremetalDB()
    method = request.method.lower()
    if method in ['get']:
        get_result = bmdb.get_baremetal_computers()
        baremetal_computers = get_result["used"]
        bm_computer_info = {}
        for cluster in baremetal_computers:
            bm_computer_info[cluster] = {}
            for bm_comp in baremetal_computers[cluster]:
                bm_computer_info[cluster][
                    bm_comp] = bmdb.get_baremetal_computer_detail(bm_comp)
        return render_template("mesh/provision/provision_main.html",
                               computers=baremetal_computers,
                               computer_info=bm_computer_info,
                               flag_idle=False,
                               )
    elif method in ['put']:
        data = request.json
        result = bmdb.withdraw_baremetal_from_user(data["computers"])
        return Response(json.dumps({"result": result}), status=200, mimetype="application/json")