Esempio n. 1
0
def get_cluster(request, name, stage):
    envs = environs_helper.get_all_env_stages(request, name)
    stages, env = common.get_all_stages(envs, stage)
    provider_list = baseimages_helper.get_all_providers(request)
    cluster_provider = clusters_helper.get_cluster_provider(request, name, stage)
    if cluster_provider == 'null':
        cluster_provider = None
    basic_cluster_info = clusters_helper.get_cluster(request, name, stage)
    advanced_cluster_info = clusters_helper.get_advanced_cluster(request, name, stage, cluster_provider)

    return render(request, 'clusters/clusters.html', {
        'env': env,
        'stages': stages,
        'provider_list': provider_list,
        'cluster_provider': cluster_provider,
        'basic_cluster_info': basic_cluster_info,
        'advanced_cluster_info': advanced_cluster_info,
    })
Esempio n. 2
0
def get_basic_cluster(request, name, stage):
    envs = environs_helper.get_all_env_stages(request, name)
    stages, env = common.get_all_stages(envs, stage)
    provider_list = baseimages_helper.get_all_providers(request)
    cluster_provider = clusters_helper.get_cluster_provider(request, name, stage)
    basic_cluster_info = clusters_helper.get_cluster(request, name, stage)
    advanced_cluster_info = clusters_helper.get_advanced_cluster(request, name, stage, cluster_provider)

    html = render_to_string('clusters/clusters.tmpl', {
        'env': env,
        'stages': stages,
        'provider_list': provider_list,
        'cluster_provider': cluster_provider,
        'basic_cluster_info': basic_cluster_info,
        'advanced_cluster_info': advanced_cluster_info,
        'csrf_token': get_token(request),
    })
    return HttpResponse(json.dumps(html), content_type="application/json")
Esempio n. 3
0
def get_cluster(request, name, stage):
    envs = environs_helper.get_all_env_stages(request, name)
    stages, env = common.get_all_stages(envs, stage)
    provider_list = baseimages_helper.get_all_providers(request)
    cluster_provider = clusters_helper.get_cluster_provider(
        request, name, stage)
    if cluster_provider == 'null':
        cluster_provider = None
    basic_cluster_info = clusters_helper.get_cluster(request, name, stage)
    advanced_cluster_info = clusters_helper.get_advanced_cluster(
        request, name, stage, cluster_provider)

    return render(
        request, 'clusters/clusters.html', {
            'env': env,
            'stages': stages,
            'provider_list': provider_list,
            'cluster_provider': cluster_provider,
            'basic_cluster_info': basic_cluster_info,
            'advanced_cluster_info': advanced_cluster_info,
        })
Esempio n. 4
0
def get_basic_cluster(request, name, stage):
    envs = environs_helper.get_all_env_stages(request, name)
    stages, env = common.get_all_stages(envs, stage)
    provider_list = baseimages_helper.get_all_providers(request)
    cluster_provider = clusters_helper.get_cluster_provider(
        request, name, stage)
    basic_cluster_info = clusters_helper.get_cluster(request, name, stage)
    advanced_cluster_info = clusters_helper.get_advanced_cluster(
        request, name, stage, cluster_provider)

    html = render_to_string(
        'clusters/clusters.tmpl', {
            'env': env,
            'stages': stages,
            'provider_list': provider_list,
            'cluster_provider': cluster_provider,
            'basic_cluster_info': basic_cluster_info,
            'advanced_cluster_info': advanced_cluster_info,
            'csrf_token': get_token(request),
        })
    return HttpResponse(json.dumps(html), content_type="application/json")
Esempio n. 5
0
def get_advanced_cluster(request):
    params = request.GET
    provider = params['provider']
    adv = int(params['adv'])
    name = params['env']
    stage = params['stage']
    cluster_name = '{}-{}'.format(name, stage)
    advanced_cluster_info = None

    if adv and provider == PROVIDER_AWS:
        advanced_cluster_info = clusters_helper.get_advanced_cluster(request, name, stage, provider)
        if not advanced_cluster_info:
            advanced_cluster_info = {}
            advanced_cluster_info['clusterName'] = cluster_name
            advanced_cluster_info['role'] = 'base'

    contents = render_to_string('clusters/get_advanced_config.tmpl', {
        'provider': provider,
        'advanced_cluster_info': advanced_cluster_info,
    })
    return HttpResponse(json.dumps(contents), content_type="application/json")
Esempio n. 6
0
def get_advanced_cluster(request):
    params = request.GET
    provider = params['provider']
    basic = int(params['basic'])
    name = params['env']
    stage = params['stage']
    cluster_name = '{}-{}'.format(name, stage)
    advanced_cluster_info = None

    if basic == 0 and provider == PROVIDER_AWS:
        advanced_cluster_info = clusters_helper.get_advanced_cluster(
            request, name, stage, provider)
        if not advanced_cluster_info:
            advanced_cluster_info = {}
            advanced_cluster_info['clusterName'] = cluster_name
            advanced_cluster_info['role'] = 'base'

    contents = render_to_string('clusters/get_advanced_config.tmpl', {
        'provider': provider,
        'advanced_cluster_info': advanced_cluster_info,
    })
    return HttpResponse(json.dumps(contents), content_type="application/json")