示例#1
0
def group_bind_template_get():
    tpl_id = request.args.get('tpl_id', '').strip()
    grp_id = request.args.get('grp_id', '').strip()
    if not tpl_id:
        return jsonify(msg="tpl id is blank")

    if not grp_id:
        return jsonify(msg="grp id is blank")

    GrpTpl.bind(grp_id, tpl_id, g.user.name)
    return jsonify(msg='')
示例#2
0
def group_bind_template_get():
    tpl_id = request.args.get('tpl_id', '').strip()
    grp_id = request.args.get('grp_id', '').strip()
    if not tpl_id:
        return jsonify(msg="tpl id is blank")

    if not grp_id:
        return jsonify(msg="grp id is blank")

    GrpTpl.bind(grp_id, tpl_id, g.user.name)
    return jsonify(msg='')
示例#3
0
def template_bind_node_post():
    node = request.form['node'].strip()
    tpl_id = request.form['tpl_id'].strip()
    if not node:
        return jsonify(msg='node is blank')

    if not tpl_id:
        return jsonify(msg='tpl id is blank')

    hg = HostGroup.read('grp_name=%s', [node])
    if not hg:
        return jsonify(msg='no such node')

    GrpTpl.bind(hg.id, tpl_id, g.user.name)
    return jsonify(msg="")
示例#4
0
def template_bind_node_post():
    node = request.form['node'].strip()
    tpl_id = request.form['tpl_id'].strip()
    if not node:
        return jsonify(msg='node is blank')

    if not tpl_id:
        return jsonify(msg='tpl id is blank')

    hg = HostGroup.read('grp_name=%s', [node])
    if not hg:
        return jsonify(msg='no such node')

    GrpTpl.bind(hg.id, tpl_id, g.user.name)
    return jsonify(msg="")