Ejemplo n.º 1
0
def vmprofilestable():
    """
    retrieves vm profiles in table
    """
    baseconfig = Kbaseconfig()
    profiles = baseconfig.list_profiles()
    return render_template('vmprofilestable.html', profiles=profiles)
Ejemplo n.º 2
0
def containerprofilestable():
    """
    retrieves container profiles in table
    """
    baseconfig = Kbaseconfig()
    profiles = baseconfig.list_containerprofiles()
    return render_template('containerprofilestable.html', profiles=profiles)
Ejemplo n.º 3
0
def hostaction():
    """
    enable/disable/default host
    """
    baseconfig = Kbaseconfig()
    if 'name' in request.form:
        name = request.form['name']
        action = request.form['action']
        if action not in ['enable', 'disable', 'switch']:
            result = {'result': 'failure', 'reason': "Invalid Action"}
            response = jsonify(result)
            response.status_code = 400
        else:
            if action == 'enable':
                result = baseconfig.enable_host(name)
            elif action == 'disable':
                result = baseconfig.disable_host(name)
            elif action == 'switch':
                result = baseconfig.switch_host(name)
            response = jsonify(result)
            response.status_code = 200
    else:
        result = {'result': 'failure', 'reason': "Invalid Data"}
        response = jsonify(result)
        response.status_code = 400
    return response
Ejemplo n.º 4
0
def containercreate():
    """
    create container
    """
    baseconfig = Kbaseconfig()
    profiles = baseconfig.list_containerprofiles()
    return render_template('containercreate.html',
                           title='CreateContainer',
                           profiles=profiles,
                           client=baseconfig.client)
Ejemplo n.º 5
0
def productcreate(prod):
    """
    product form
    """
    config = Kbaseconfig()
    info = config.info_product(prod, verbose=False)
    parameters = info['parameters']
    description = info['description']
    comments = info['comments']
    return render_template('productcreate.html', title='CreateProduct', client=config.client, product=prod,
                           parameters=parameters, description=description, comments=comments)
Ejemplo n.º 6
0
def productstable():
    """
    retrieves all products in table
    """
    baseconfig = Kbaseconfig()
    products = []
    for product in baseconfig.list_products():
        repo = product['repo']
        group = product['group']
        name = product['name']
        description = product['description']
        numvms = product['numvms']
        products.append([repo, group, name, description, numvms])
    return render_template('productstable.html', products=products)
Ejemplo n.º 7
0
def vms():
    """

    :return:
    """
    baseconfig = Kbaseconfig()
    return render_template('vms.html', title='Home', client=baseconfig.client)
Ejemplo n.º 8
0
def productcreate(prod):
    """
    product form
    """
    config = Kbaseconfig()
    productinfo = config.info_product(prod, web=True)
    parameters = productinfo.get('parameters', {})
    description = parameters.get('description', '')
    info = parameters.get('info', '')
    return render_template('productcreate.html',
                           title='CreateProduct',
                           client=config.client,
                           product=prod,
                           parameters=parameters,
                           description=description,
                           info=info)
Ejemplo n.º 9
0
def containerprofiles():
    """
    retrieves all containerprofiles
    """
    baseconfig = Kbaseconfig()
    return render_template('containerprofiles.html',
                           title='ContainerProfiles',
                           client=baseconfig.client)
Ejemplo n.º 10
0
def products():
    """

    :return:
    """
    baseconfig = Kbaseconfig()
    return render_template('products.html',
                           title='Products',
                           client=baseconfig.client)
Ejemplo n.º 11
0
def vmprofiles():
    """

    :return:
    """
    baseconfig = Kbaseconfig()
    return render_template('vmprofiles.html',
                           title='VmProfiles',
                           client=baseconfig.client)
Ejemplo n.º 12
0
def hoststable():
    """
    retrieves all hosts in table
    """
    baseconfig = Kbaseconfig()
    clients = []
    for client in sorted(baseconfig.clients):
        enabled = baseconfig.ini[client].get('enabled', True)
        _type = baseconfig.ini[client].get('type', 'kvm')
        if client == baseconfig.client:
            clients.append([client, _type, enabled, 'X'])
        else:
            clients.append([client, _type, enabled, ''])
    return render_template('hoststable.html', clients=clients)