コード例 #1
0
ファイル: common.py プロジェクト: zmyer/teletraan
def clone_from_stage_name(request, env_name, stage_name, from_env_name,
                          from_stage_name, description):
    from_stage = environs_helper.get_env_by_stage(request, from_env_name,
                                                  from_stage_name)
    agent_configs = environs_helper.get_env_agent_config(
        request, from_env_name, from_stage_name)
    script_configs = environs_helper.get_env_script_config(
        request, from_env_name, from_stage_name)
    alarms_configs = environs_helper.get_env_alarms_config(
        request, from_env_name, from_stage_name)
    metrics_configs = environs_helper.get_env_metrics_config(
        request, from_env_name, from_stage_name)
    webhooks_configs = environs_helper.get_env_hooks_config(
        request, from_env_name, from_stage_name)
    promotes_configs = environs_helper.get_env_promotes_config(
        request, from_env_name, from_stage_name)

    new_data = {}
    new_data['envName'] = env_name
    new_data['stageName'] = stage_name
    new_data['description'] = description
    new_data['buildName'] = from_stage['buildName']
    new_data['branch'] = from_stage['branch']
    new_data['chatroom'] = from_stage['chatroom']
    new_data['maxParallel'] = from_stage['maxParallel']
    new_data['priority'] = from_stage['priority']
    new_data['stuckThreshold'] = from_stage['stuckThreshold']
    new_data['successThreshold'] = from_stage['successThreshold']
    new_data['acceptanceType'] = from_stage['acceptanceType']
    new_data['emailRecipients'] = from_stage['emailRecipients']
    new_data['notifyAuthors'] = from_stage['notifyAuthors']
    new_data['watchRecipients'] = from_stage['watchRecipients']
    new_data['maxDeployNum'] = from_stage['maxDeployNum']
    new_data['maxDeployDay'] = from_stage['maxDeployDay']
    new_data['overridePolicy'] = from_stage['overridePolicy']

    new_stage = environs_helper.create_env(request, new_data)

    # now clone all the extra configs
    if agent_configs:
        environs_helper.update_env_agent_config(request, env_name, stage_name,
                                                agent_configs)
    if script_configs:
        environs_helper.update_env_script_config(request, env_name, stage_name,
                                                 script_configs)
    if alarms_configs:
        environs_helper.update_env_alarms_config(request, env_name, stage_name,
                                                 alarms_configs)
    if metrics_configs:
        environs_helper.update_env_metrics_config(request, env_name,
                                                  stage_name, metrics_configs)
    if webhooks_configs:
        environs_helper.update_env_hooks_config(request, env_name, stage_name,
                                                webhooks_configs)
    if promotes_configs:
        environs_helper.update_env_promotes_config(request, env_name,
                                                   stage_name,
                                                   promotes_configs)

    return new_stage
コード例 #2
0
ファイル: promote_views.py プロジェクト: DomenZero/teletraan
 def post(self, request, name, stage):
     query_dict = request.POST
     data = {}
     data["type"] = query_dict["promoteType"]
     data["predStage"] = query_dict["predStageName"]
     data["failPolicy"] = query_dict["promoteFailPolicy"]
     data["disablePolicy"] = query_dict["promoteDisablePolicy"]
     data["schedule"] = query_dict["promoteSchedule"]
     if 'promoteDelay' in query_dict:
         data["delay"] = int(query_dict["promoteDelay"])
     if "promoteQueueSize" in query_dict:
         data["queueSize"] = int(query_dict["promoteQueueSize"])
     environs_helper.update_env_promotes_config(request, name, stage, data=data)
     return self.get(request, name, stage)
コード例 #3
0
ファイル: common.py プロジェクト: lilida/teletraan
def clone_from_stage_name(request, env_name, stage_name, from_env_name, from_stage_name,
                          description, external_id):
    from_stage = environs_helper.get_env_by_stage(request, from_env_name, from_stage_name)
    agent_configs = environs_helper.get_env_agent_config(request, from_env_name, from_stage_name)
    script_configs = environs_helper.get_env_script_config(request, from_env_name, from_stage_name)
    alarms_configs = environs_helper.get_env_alarms_config(request, from_env_name, from_stage_name)
    metrics_configs = environs_helper.get_env_metrics_config(request, from_env_name,
                                                             from_stage_name)
    webhooks_configs = environs_helper.get_env_hooks_config(request, from_env_name, from_stage_name)
    promotes_configs = environs_helper.get_env_promotes_config(request, from_env_name,
                                                               from_stage_name)

    new_data = {}
    new_data['envName'] = env_name
    new_data['stageName'] = stage_name
    new_data['description'] = description
    new_data['buildName'] = from_stage['buildName']
    new_data['branch'] = from_stage['branch']
    new_data['chatroom'] = from_stage['chatroom']
    new_data['maxParallel'] = from_stage['maxParallel']
    new_data['priority'] = from_stage['priority']
    new_data['stuckThreshold'] = from_stage['stuckThreshold']
    new_data['successThreshold'] = from_stage['successThreshold']
    new_data['acceptanceType'] = from_stage['acceptanceType']
    new_data['emailRecipients'] = from_stage['emailRecipients']
    new_data['notifyAuthors'] = from_stage['notifyAuthors']
    new_data['watchRecipients'] = from_stage['watchRecipients']
    new_data['maxDeployNum'] = from_stage['maxDeployNum']
    new_data['maxDeployDay'] = from_stage['maxDeployDay']
    new_data['overridePolicy'] = from_stage['overridePolicy']
    new_data['externalId'] = external_id

    new_stage = environs_helper.create_env(request, new_data)

    # now clone all the extra configs
    if agent_configs:
        environs_helper.update_env_agent_config(request, env_name, stage_name, agent_configs)
    if script_configs:
        environs_helper.update_env_script_config(request, env_name, stage_name, script_configs)
    if alarms_configs:
        environs_helper.update_env_alarms_config(request, env_name, stage_name, alarms_configs)
    if metrics_configs:
        environs_helper.update_env_metrics_config(request, env_name, stage_name, metrics_configs)
    if webhooks_configs:
        environs_helper.update_env_hooks_config(request, env_name, stage_name, webhooks_configs)
    if promotes_configs:
        environs_helper.update_env_promotes_config(request, env_name, stage_name, promotes_configs)

    return new_stage
コード例 #4
0
ファイル: promote_views.py プロジェクト: zeus911/teletraan
 def post(self, request, name, stage):
     query_dict = request.POST
     data = {}
     data["type"] = query_dict["promoteType"]
     data["predStage"] = query_dict["predStageName"]
     data["failPolicy"] = query_dict["promoteFailPolicy"]
     data["disablePolicy"] = query_dict["promoteDisablePolicy"]
     data["schedule"] = query_dict["promoteSchedule"]
     if 'promoteDelay' in query_dict:
         data["delay"] = int(query_dict["promoteDelay"])
     if "promoteQueueSize" in query_dict:
         data["queueSize"] = int(query_dict["promoteQueueSize"])
     environs_helper.update_env_promotes_config(request,
                                                name,
                                                stage,
                                                data=data)
     return self.get(request, name, stage)