Ejemplo n.º 1
0
def update_group_config(request, group_name):
    try:
        params = request.POST
        groupRequest = {}
        groupRequest["chatroom"] = params.get("chatroom")
        groupRequest["watchRecipients"] = params.get("watch_recipients")
        groupRequest["emailRecipients"] = params.get("email_recipients")
        groupRequest["pagerRecipients"] = params.get("pager_recipients")
        groupRequest["launchLatencyTh"] = int(params["launch_latency_th"]) * 60
        if "healthcheck_state" in params:
            groupRequest["healthcheckState"] = True
        else:
            groupRequest["healthcheckState"] = False
        groupRequest["healthcheckPeriod"] = int(params["healthcheck_period"]) * 60

        if "lifecycle_state" in params:
            groupRequest["lifecycleState"] = True
        else:
            groupRequest["lifecycleState"] = False
        groupRequest["lifecycleTimeout"] = int(params["lifecycle_timeout"]) * 60
        groups_helper.update_group_info(request, group_name, groupRequest)
        return get_group_config(request, group_name)
    except:
        log.error(traceback.format_exc())
        raise
Ejemplo n.º 2
0
def update_group_config(request, group_name):
    try:
        params = request.POST
        groupRequest = {}
        groupRequest["chatroom"] = params["chatroom"]
        groupRequest["watchRecipients"] = params["watch_recipients"]
        groupRequest["emailRecipients"] = params["email_recipients"]
        groupRequest["pagerRecipients"] = params["pager_recipients"]
        groupRequest["launchLatencyTh"] = int(params["launch_latency_th"]) * 60
        if "healthcheck_state" in params:
            groupRequest["healthcheckState"] = True
        else:
            groupRequest["healthcheckState"] = False
        groupRequest["healthcheckPeriod"] = int(params["healthcheck_period"]) * 60

        if "lifecycle_state" in params:
            groupRequest["lifecycleState"] = True
        else:
            groupRequest["lifecycleState"] = False
        groupRequest["lifecycleTimeout"] = int(params["lifecycle_timeout"]) * 60
        groups_helper.update_group_info(request, group_name, groupRequest)
        return get_group_config(request, group_name)
    except:
        log.error(traceback.format_exc())
        raise
Ejemplo n.º 3
0
def update_launch_config(request, group_name):
    try:
        params = request.POST
        launchRequest = {}
        launchRequest["groupName"] = group_name
        launchRequest["instanceType"] = params["instanceType"]
        launchRequest["securityGroup"] = params["securityGroup"]
        launchRequest["imageId"] = params["imageId"]
        launchRequest["userData"] = params["userData"]
        launchRequest["chatroom"] = params["chatroom"]
        launchRequest["watchRecipients"] = params["watch_recipients"]
        launchRequest["emailRecipients"] = params["email_recipients"]
        launchRequest["pagerRecipients"] = params["pager_recipients"]
        launchRequest["launchLatencyTh"] = int(
            params["launch_latency_th"]) * 60
        launchRequest["iamRole"] = params["iam_role"]
        launchRequest["subnets"] = ",".join(params.getlist("subnets"))
        launchRequest["asgStatus"] = params["asg_status"]

        if params["assignPublicIP"] == "True":
            launchRequest["assignPublicIp"] = True
        else:
            launchRequest["assignPublicIp"] = False

        if "healthcheck_state" in params:
            launchRequest["healthcheckState"] = True
        else:
            launchRequest["healthcheckState"] = False
        launchRequest["healthcheckPeriod"] = int(
            params["healthcheck_period"]) * 60

        if "lifecycle_state" in params:
            launchRequest["lifecycleState"] = True
        else:
            launchRequest["lifecycleState"] = False
        launchRequest["lifecycleTimeout"] = int(
            params["lifecycle_timeout"]) * 60
        groups_helper.update_group_info(request, group_name, launchRequest)
        return get_launch_config(request, group_name)
    except:
        log.error(traceback.format_exc())
        raise
Ejemplo n.º 4
0
def update_launch_config(request, group_name):
    try:
        params = request.POST
        launchRequest = {}
        launchRequest["groupName"] = group_name
        launchRequest["instanceType"] = params["instanceType"]
        launchRequest["securityGroup"] = params["securityGroup"]
        launchRequest["imageId"] = params["imageId"]
        launchRequest["userData"] = params["userData"]
        launchRequest["chatroom"] = params["chatroom"]
        launchRequest["watchRecipients"] = params["watch_recipients"]
        launchRequest["emailRecipients"] = params["email_recipients"]
        launchRequest["pagerRecipients"] = params["pager_recipients"]
        launchRequest["launchLatencyTh"] = int(params["launch_latency_th"]) * 60
        launchRequest["iamRole"] = params["iam_role"]
        launchRequest["subnets"] = ",".join(params.getlist("subnets"))
        launchRequest["asgStatus"] = params["asg_status"]

        if params["assignPublicIP"] == "True":
            launchRequest["assignPublicIp"] = True
        else:
            launchRequest["assignPublicIp"] = False

        if "healthcheck_state" in params:
            launchRequest["healthcheckState"] = True
        else:
            launchRequest["healthcheckState"] = False
        launchRequest["healthcheckPeriod"] = int(params["healthcheck_period"]) * 60

        if "lifecycle_state" in params:
            launchRequest["lifecycleState"] = True
        else:
            launchRequest["lifecycleState"] = False
        launchRequest["lifecycleTimeout"] = int(params["lifecycle_timeout"]) * 60
        groups_helper.update_group_info(request, group_name,  launchRequest)
        return get_launch_config(request, group_name)
    except:
        log.error(traceback.format_exc())
        raise