Esempio n. 1
0
def get_asg_config(request, group_name):
    asg_summary = groups_helper.get_autoscaling_summary(request, group_name)
    instances = groups_helper.get_group_instances(request, group_name)
    group_info = groups_helper.get_group_info(request, group_name)
    launch_config = group_info.get("launchInfo")
    group_size = len(instances)
    policies = groups_helper.TerminationPolicy
    if asg_summary.get("spotRatio", None):
        asg_summary["spotRatio"] *= 100
    if asg_summary.get("sensitivityRatio", None):
        asg_summary["sensitivityRatio"] *= 100
    scheduled_actions = groups_helper.get_scheduled_actions(request, group_name)
    time_based_asg = False
    if len(scheduled_actions) > 0:
        time_based_asg = True
    content = render_to_string("groups/asg_config.tmpl", {
        "group_name": group_name,
        "asg": asg_summary,
        "group_size": group_size,
        "terminationPolicies": policies,
        "instanceType": launch_config.get("instanceType"),
        "time_based_asg": time_based_asg,
        "csrf_token": get_token(request),
    })
    return HttpResponse(json.dumps(content), content_type="application/json")
Esempio n. 2
0
 def get(self, request, group_name):
     autoscaling_summary = groups_helper.get_autoscaling_summary(request, group_name)
     asg_status = autoscaling_summary.get("status", "UNKNOWN")
     enable_spot = autoscaling_summary.get("enableSpot", False)
     envs = environs_helper.get_all_envs_by_group(request, group_name)
     scaling_down_event_enabled = groups_helper.get_scaling_down_event_status(request, group_name)
     return render(request, 'groups/group_details.html', {
         "asg_status": asg_status,
         "enable_spot": enable_spot,
         "group_name": group_name,
         "scaling_down_event_enabled": scaling_down_event_enabled,
         "envs": envs,
     })
Esempio n. 3
0
 def get(self, request, group_name):
     autoscaling_summary = groups_helper.get_autoscaling_summary(request, group_name)
     asg_status = autoscaling_summary.get("status", "UNKNOWN")
     enable_spot = autoscaling_summary.get("enableSpot", False)
     envs = environs_helper.get_all_envs_by_group(request, group_name)
     scaling_down_event_enabled = groups_helper.get_scaling_down_event_status(request, group_name)
     return render(request, 'groups/group_details.html', {
         "asg_status": asg_status,
         "enable_spot": enable_spot,
         "group_name": group_name,
         "scaling_down_event_enabled": scaling_down_event_enabled,
         "envs": envs,
     })
Esempio n. 4
0
def get_asg_config(request, group_name):
    asg_summary = groups_helper.get_autoscaling_summary(request, group_name)
    instances = groups_helper.get_group_instances(request, group_name)
    group_info = groups_helper.get_group_info(request, group_name)
    group_size = len(instances)
    policies = groups_helper.TerminationPolicy
    if asg_summary.get("spotRatio", None):
        asg_summary["spotRatio"] *= 100
    if asg_summary.get("sensitivityRatio", None):
        asg_summary["sensitivityRatio"] *= 100
    content = render_to_string("groups/asg_config.tmpl", {
        "group_name": group_name,
        "asg": asg_summary,
        "group_size": group_size,
        "terminationPolicies": policies,
        "instanceType": group_info.get("instanceType"),
        "csrf_token": get_token(request),
    })
    return HttpResponse(json.dumps(content), content_type="application/json")