Example #1
0
def deploy_mgmt():
    script_id = request.args.get('script_id')
    if not script_id or script_id == '0':
        script = Script(name='', notes='', script='')
    else:
        script = Script.query.get(script_id)
    return render_template(
            'ui/script.html', scripts=Script.query.order_by(Script.date.desc()),
            script=script)
Example #2
0
def create_script():
    missing = Script.check_required(request.json)
    if missing:
        return error_response(errors.API_FIELDS_MISSING.format(missing), 400)
    else:
        script = Script(**request.json)
        script.user = current_user
        db.session.add(script)
        db.session.commit()
        return jsonify(script.to_dict())