Example #1
0
 def get(self, request, group_name):
     asg_cluster = groups_helper.get_group_info(request, group_name)
     appNames = images_helper.get_all_app_names(request)
     appNames = sorted(appNames)
     is_cmp = False
     if asg_cluster:
         asg_vm_info = asg_cluster.get("launchInfo")
         if asg_vm_info and asg_vm_info.get("subnets"):
              asg_vm_info["subnetArrays"] = asg_vm_info["subnets"].split(',')
         group_info = asg_cluster.get("groupInfo")
         curr_image = images_helper.get_image_by_id(request, asg_vm_info["imageId"])
         group_info = get_group_config_internal(group_info)
         envs = environs_helper.get_all_envs_by_group(request, group_name)
         for env in envs:
             basic_cluster_info = clusters_helper.get_cluster(request, env.get('envName'), env.get('stageName'))
             if basic_cluster_info:
                 is_cmp = True
     else:
         asg_vm_info = None
         group_info = None
         curr_image = None
     return render(request, 'groups/asg_config.html', {
         "asg_vm_config": asg_vm_info,
         "app_names": appNames,
         "curr_image": curr_image,
         "group_config": group_info,
         "group_name": group_name,
         "is_cmp": is_cmp
     })
Example #2
0
def get_launch_config(request, group_name):
    try:
        group_info = groups_helper.get_group_info(request, group_name)
        if group_info and group_info.get("subnets"):
            group_info["subnetArrays"] = group_info["subnets"].split(',')
        if group_info and not group_info.get("asgStatus"):
            group_info["asgStatus"] = "UNKNOWN"
        if group_info and group_info.get("launchLatencyTh"):
            group_info["launchLatencyTh"] = group_info.get(
                "launchLatencyTh") / 60
        if group_info and group_info.get("healthcheckPeriod"):
            group_info["healthcheckPeriod"] = group_info.get(
                "healthcheckPeriod") / 60
        if group_info and group_info.get("lifecycleTimeout"):
            group_info["lifecycleTimeout"] = group_info.get(
                "lifecycleTimeout") / 60

        appNames = images_helper.get_all_app_names(request)
        appNames = sorted(appNames)
        curr_image = images_helper.get_image_by_id(request,
                                                   group_info["imageId"])
        html = render_to_string(
            'groups/group_config.tmpl', {
                "group_name": group_name,
                "app_names": appNames,
                "config": group_info,
                "curr_image": curr_image,
                "csrf_token": get_token(request),
            })
    except:
        log.error(traceback.format_exc())
        raise
    return HttpResponse(json.dumps(html), content_type="application/json")
Example #3
0
def get_launch_config(request, group_name):
    try:
        group_info = groups_helper.get_group_info(request, group_name)
        if group_info and group_info.get("subnets"):
            group_info["subnetArrays"] = group_info["subnets"].split(',')
        if group_info and not group_info.get("asgStatus"):
            group_info["asgStatus"] = "UNKNOWN"
        if group_info and group_info.get("launchLatencyTh"):
            group_info["launchLatencyTh"] = group_info.get("launchLatencyTh") / 60
        if group_info and group_info.get("healthcheckPeriod"):
            group_info["healthcheckPeriod"] = group_info.get("healthcheckPeriod") / 60
        if group_info and group_info.get("lifecycleTimeout"):
            group_info["lifecycleTimeout"] = group_info.get("lifecycleTimeout") / 60

        appNames = images_helper.get_all_app_names(request)
        appNames = sorted(appNames)
        curr_image = images_helper.get_image_by_id(request, group_info["imageId"])
        html = render_to_string('groups/group_config.tmpl', {
            "group_name": group_name,
            "app_names": appNames,
            "config": group_info,
            "curr_image": curr_image,
            "csrf_token": get_token(request),
        })
    except:
        log.error(traceback.format_exc())
        raise
    return HttpResponse(json.dumps(html), content_type="application/json")
Example #4
0
 def get(self, request, group_name):
     asg_cluster = groups_helper.get_group_info(request, group_name)
     appNames = images_helper.get_all_app_names(request)
     appNames = sorted(appNames)
     is_cmp = False
     if asg_cluster:
         asg_vm_info = asg_cluster.get("launchInfo")
         if asg_vm_info and asg_vm_info.get("subnets"):
             asg_vm_info["subnetArrays"] = asg_vm_info["subnets"].split(',')
         group_info = asg_cluster.get("groupInfo")
         curr_image = images_helper.get_image_by_id(request,
                                                    asg_vm_info["imageId"])
         group_info = get_group_config_internal(group_info)
         envs = environs_helper.get_all_envs_by_group(request, group_name)
         for env in envs:
             basic_cluster_info = clusters_helper.get_cluster(
                 request, env.get('envName'), env.get('stageName'))
             if basic_cluster_info:
                 is_cmp = True
     else:
         asg_vm_info = None
         group_info = None
         curr_image = None
     return render(
         request, 'groups/asg_config.html', {
             "asg_vm_config": asg_vm_info,
             "app_names": appNames,
             "curr_image": curr_image,
             "group_config": group_info,
             "group_name": group_name,
             "is_cmp": is_cmp
         })
Example #5
0
def get_launch_config(request, group_name):
    try:
        group_info = groups_helper.get_group_info(request, group_name)
        launch_config = group_info.get("launchInfo")

        if launch_config and launch_config.get("subnets"):
            launch_config["subnetArrays"] = launch_config["subnets"].split(',')
        appNames = images_helper.get_all_app_names(request)
        appNames = sorted(appNames)
        curr_image = images_helper.get_image_by_id(request, launch_config["imageId"])
        html = render_to_string('groups/launch_config.tmpl', {
            "group_name": group_name,
            "app_names": appNames,
            "config": launch_config,
            "curr_image": curr_image,
            "csrf_token": get_token(request),
        })
    except:
        log.error(traceback.format_exc())
        raise
    return HttpResponse(json.dumps(html), content_type="application/json")
Example #6
0
def get_launch_config(request, group_name):
    try:
        group_info = groups_helper.get_group_info(request, group_name)
        launch_config = group_info.get("launchInfo")

        if launch_config and launch_config.get("subnets"):
            launch_config["subnetArrays"] = launch_config["subnets"].split(',')
        appNames = images_helper.get_all_app_names(request)
        appNames = sorted(appNames)
        curr_image = images_helper.get_image_by_id(request, launch_config["imageId"])
        html = render_to_string('groups/launch_config.tmpl', {
            "group_name": group_name,
            "app_names": appNames,
            "config": launch_config,
            "curr_image": curr_image,
            "csrf_token": get_token(request),
        })
    except:
        log.error(traceback.format_exc())
        raise
    return HttpResponse(json.dumps(html), content_type="application/json")
Example #7
0
 def get(self, request, group_name):
     asg_cluster = groups_helper.get_group_info(request, group_name)
     appNames = images_helper.get_all_app_names(request)
     appNames = sorted(appNames)
     if asg_cluster:
         asg_vm_info = asg_cluster.get("launchInfo")
         if asg_vm_info and asg_vm_info.get("subnets"):
              asg_vm_info["subnetArrays"] = asg_vm_info["subnets"].split(',')
         group_info = asg_cluster.get("groupInfo")
         curr_image = images_helper.get_image_by_id(request, asg_vm_info["imageId"])
         group_info = get_group_config_internal(group_info)
     else:
         asg_vm_info = None
         group_info = None
         curr_image = None
     return render(request, 'groups/asg_config.html', {
         "asg_vm_config": asg_vm_info,
         "app_names": appNames,
         "curr_image": curr_image,
         "group_config": group_info,
         "group_name": group_name,
     })