Пример #1
0
def deploy_add():
    form = DeployForm()
    if form.validate_on_submit():
        deploy.add_server(form)
        flash(_('Server added'))
        return redirect(url_for("deploy.deploy_list"))
    return render_template('deploy_add.html', form=form)
Пример #2
0
def deploy_add():
    form = DeployForm()
    if form.validate_on_submit():
        deploy.add_server(form)
        flash(_('Server added'))
        return redirect(url_for("deploy.deploy_list"))
    return render_template('deploy_add.html', form=form)
Пример #3
0
def deployui():
    form = DeployForm()
    if form.validate_on_submit():
        #print(request.form.to_dict())
        args = copy.deepcopy(request.form.to_dict())
        del args['csrf_token']
        return redirect(url_for('deployImage', **args))
    return render_template('deploy.html', title='nexo', form=form)
Пример #4
0
def deploy():
    form = DeployForm()
    if form.validate_on_submit():
        timestamp = int(time.time())
        idc = Idc.query.filter_by(id=form.idc.data).first()
        playbook = Playbook.query.filter_by(id=form.playbook.data).first()
        ip_list = form.ip_list.data.encode()
        lists = ip_list.replace('\r', '').split('\n')
        playbook_run()
        current_app.logger.info("%s command %s %s %s", current_user.username,
                                idc.name, playbook.name, lists)
        return redirect(url_for("main.deploy"))
    return render_template("deploy.html", form=form)
Пример #5
0
def deploy_project():
    from forms import DeployForm
    form=DeployForm()
    auth=False
    #res=RepoInfo.query()
    if form.validate_on_submit():
        if check_deploy_passwd(form.repo_name.data.repo_name,form.deploy_env.data,form.password.data):
            #开始发布代码
            #repo_type=RepoInfo.query.filter_by(repo_name=form.repo_name.data).first().repo_type.encode('utf-8')
            result,info=get_deploy_info(form.repo_name.data.repo_name.encode('utf-8').strip(' '),form.deploy_env.data.encode('utf-8').strip(' '),form.password.data.encode('utf-8').strip(' '),g.user.email.encode('utf-8').strip(' '))
            if result:
                return redirect(url_for('display_deploy_info'))
            else:
                return render_template('deploy.html',form=form,errors=info)
        else:
            auth=True
            return render_template('deploy.html',auth=auth,form=form)
    return render_template('deploy.html',form=form,auth=auth)
Пример #6
0
def index(webapp):
    if webapp not in settings.WEBAPPS.keys():
        abort(404)
    else:
        app_settings = settings.WEBAPPS[webapp]

    errors = []
    form = DeployForm(request.form)
    if request.method == 'POST' and form.validate():
        if form.password.data == app_settings['password']:
            return Response(do_update(webapp, app_settings,
                                      form.ref.data, form.who.data),
                            direct_passthrough=True,
                            mimetype='text/plain')
        else:
            errors.append("Incorrect password")

    return render_template("index.html", app_name=webapp,
                           form=form, errors=errors)
Пример #7
0
def index(webapp):
    if webapp not in settings.WEBAPPS.keys():
        abort(404)
    else:
        app_settings = fix_settings(settings.WEBAPPS[webapp])

    errors = []
    form = DeployForm(request.form)
    if request.method == 'POST' and form.validate():
        if form.password.data == app_settings['password']:
            return Response(do_update(webapp, app_settings, form.ref.data,
                                      form.who.data),
                            direct_passthrough=True,
                            mimetype='text/plain')
        else:
            errors.append("Incorrect password")

    return render_template("index.html",
                           app_name=webapp,
                           form=form,
                           errors=errors)
Пример #8
0
def deploy_project():
    from forms import DeployForm
    form = DeployForm()
    auth = False
    #res=RepoInfo.query()
    if form.validate_on_submit():
        if check_deploy_passwd(form.repo_name.data.repo_name,
                               form.deploy_env.data, form.password.data):
            #开始发布代码
            #repo_type=RepoInfo.query.filter_by(repo_name=form.repo_name.data).first().repo_type.encode('utf-8')
            result, info = get_deploy_info(
                form.repo_name.data.repo_name.encode('utf-8').strip(' '),
                form.deploy_env.data.encode('utf-8').strip(' '),
                form.password.data.encode('utf-8').strip(' '),
                g.user.email.encode('utf-8').strip(' '))
            if result:
                return redirect(url_for('display_deploy_info'))
            else:
                return render_template('deploy.html', form=form, errors=info)
        else:
            auth = True
            return render_template('deploy.html', auth=auth, form=form)
    return render_template('deploy.html', form=form, auth=auth)