예제 #1
0
def add(dbtype):
    if request.method == 'POST':
        name = request.form.get('name')
        ml = request.form.get('memory_limit')
        pm = request.form.get('port_mapping', 'off')
        if pm == 'on':
            pm = True
        else:
            pm = False
        docker.create_container(dbtype, name, ml, pm)
        flash('Server successfully started.', 'success')
        return redirect(url_for('index'))
    return render_template('add.html', dbtype=dbtype)
예제 #2
0
def add(dbtype):
    if request.method == 'POST':
        name = request.form.get('name')
        ml = request.form.get('memory_limit')
        pm = request.form.get('port_mapping', 'off')
        if pm == 'on':
            pm = True
        else:
            pm = False
        docker.create_container(dbtype, name, ml, pm)
        flash('Server successfully started.', 'success')
        return redirect(url_for('index'))
    return render_template('add.html', dbtype=dbtype)
예제 #3
0
def create(dbtype, name, nopm=False, memorylimit=256):
    """dbaas create DB_TYPE NAME"""
    try:
        pm = not nopm
        container = docker.create_container(dbtype, name, memorylimit, pm)
        print "%s Started container %s" % (ok(), container['Id'])
        print 'Waiting for database to boot...'
        time.sleep(5)
        return test(container['Id'])
    except Exception, e:
        print '%s %s' % (ko(), e)
예제 #4
0
def create(dbtype, name, nopm=False, memorylimit=256):
    """dbaas create DB_TYPE NAME"""
    try:
        pm = not nopm
        container = docker.create_container(dbtype, name, memorylimit, pm)
        print "%s Started container %s" % (ok(), container['Id'])
        print 'Waiting for database to boot...'
        time.sleep(5)
        return test(container['Id'])
    except Exception, e:
       print '%s %s' % (ko(), e)