示例#1
0
文件: api.py 项目: zq920320/pydelo
def update_deploy_by_id(id):
    action = request.form.get("action")
    deploy = deploys.get(id)
    if action == "redeploy":
        new_deploy = deploys.create(user_id=deploy.user_id,
                                    project_id=deploy.project_id,
                                    host_id=deploy.host_id,
                                    mode=deploy.mode,
                                    status=2,
                                    branch=deploy.branch,
                                    version=deploy.version,
                                    softln_filename=deploy.softln_filename)
        deploys.deploy(new_deploy)
        return jsonify(dict(rc=0, data=dict(id=new_deploy.id)))
    elif action == "rollback":
        new_deploy = deploys.create(user_id=deploy.user_id,
                                    project_id=deploy.project_id,
                                    host_id=deploy.host_id,
                                    mode=2,
                                    status=2,
                                    branch=deploy.branch,
                                    version=deploy.version,
                                    softln_filename=deploy.softln_filename)
        deploys.rollback(new_deploy)
        return jsonify(dict(rc=0, data=dict(id=new_deploy.id)))
    else:
        raise Error(10000, msg=None)
示例#2
0
文件: api.py 项目: bingone/pydelo
def update_deploy_by_id(id):
    action = request.form.get("action")
    deploy = deploys.get(id)
    if action == "redeploy":
        new_deploy = deploys.create(
            user_id=deploy.user_id,
            project_id=deploy.project_id,
            host_id=deploy.host_id,
            mode=deploy.mode,
            status=2,
            branch=deploy.branch,
            version=deploy.version,
            softln_filename=deploy.softln_filename)
        deploys.deploy(new_deploy)
        return jsonify(dict(rc=0, data=dict(id=new_deploy.id)))
    elif action == "rollback":
        new_deploy = deploys.create(
            user_id=deploy.user_id,
            project_id=deploy.project_id,
            host_id=deploy.host_id,
            mode=2,
            status=2,
            branch=deploy.branch,
            version=deploy.version,
            softln_filename=deploy.softln_filename)
        deploys.rollback(new_deploy)
        return jsonify(dict(rc=0, data=dict(id=new_deploy.id)))
    else:
        raise Error(10000, msg=None)
示例#3
0
文件: api.py 项目: nevernet/pydelo
def update_deploy_by_id(id):
    action = request.form.get("action")
    deploy = deploys.get(id)
    if action == "redeploy":
        new_deploy = deploys.create(
            user_id=deploy.user_id,
            project_id=deploy.project_id,
            host_id=deploy.host_id,
            mode=deploy.mode,
            status=2,
            branch=deploy.branch,
            version=deploy.version,
            softln_filename=deploy.softln_filename)
        deploys.deploy(new_deploy)
        return jsonify(dict(rc=0, data=dict(id=new_deploy.id)))
    elif action == "rollback":
        # new_deploy = deploys.create(
        #     user_id=deploy.user_id,
        #     project_id=deploy.project_id,
        #     host_id=deploy.host_id,
        #     mode=2,
        #     status=2,
        #     branch=deploy.branch,
        #     version=deploy.version,
        #     softln_filename=deploy.softln_filename)
        # deploys.rollback(new_deploy)

        # return jsonify(dict(rc=0, data=dict(id=new_deploy.id)))

        msg = deploys_new.rollback(deploy)
        deploys.update(deploy, **dict(deploy_status=2))
        return jsonify(dict(rc=0, msg=msg))

    elif action == "publish":
        msg = deploys_new.publish(deploy)
        deploys.update(deploy, **dict(deploy_status=1))
        return jsonify(dict(rc=0, msg=msg))
    elif action == "cancel":
        deploys.update(deploy, **dict(deploy_status=99))
        return jsonify(dict(rc=0, data=None))
    else:
        return jsonify(dict(rc=-1, msg="action is not supported"))
示例#4
0
文件: api.py 项目: nevernet/pydelo
def get_deploy_progress_by_id(id):
    deploy = deploys.get(id)
    return jsonify(dict(rc=0, data=deploy))
示例#5
0
文件: api.py 项目: zq920320/pydelo
def get_deploy_progress_by_id(id):
    deploy = deploys.get(id)
    return jsonify(dict(rc=0, data=deploy))