Exemple #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='')
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='')
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="")
Exemple #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="")