示例#1
0
 def check_deploy_group(self) -> Tuple[bool, str]:
     deploy_group = self.get_deploy_group()
     if deploy_group is not None:
         pipeline_deploy_groups = get_pipeline_deploy_groups(
             service=self.service, soa_dir=self.soa_dir)
         if deploy_group not in pipeline_deploy_groups:
             return False, f'deploy_group {deploy_group} is not in service {self.service} deploy.yaml'
     return True, ''
示例#2
0
def deployments_check(service, soa_dir):
    """Checks for consistency between deploy.yaml and the marathon yamls"""
    the_return = True
    pipeline_deploy_groups = get_pipeline_deploy_groups(
        service=service, soa_dir=soa_dir
    )

    framework_deploy_groups = {}
    in_deploy_not_frameworks = set(pipeline_deploy_groups)
    for it in INSTANCE_TYPES:
        framework_deploy_groups[it] = get_deploy_groups_used_by_framework(
            it, service, soa_dir
        )
        in_framework_not_deploy = set(framework_deploy_groups[it]) - set(
            pipeline_deploy_groups
        )
        in_deploy_not_frameworks -= set(framework_deploy_groups[it])
        if len(in_framework_not_deploy) > 0:
            paasta_print(
                "{} There are some instance(s) you have asked to run in {} that".format(
                    x_mark(), it
                )
            )
            paasta_print("  do not have a corresponding entry in deploy.yaml:")
            paasta_print("  %s" % PaastaColors.bold(", ".join(in_framework_not_deploy)))
            paasta_print(
                "  You should probably configure these to use a 'deploy_group' or"
            )
            paasta_print(
                "  add entries to deploy.yaml for them so they are deployed to those clusters."
            )
            the_return = False

    if len(in_deploy_not_frameworks) > 0:
        paasta_print(
            "%s There are some instance(s) in deploy.yaml that are not referenced"
            % x_mark()
        )
        paasta_print("  by any marathon or adhoc instance:")
        paasta_print("  %s" % PaastaColors.bold((", ".join(in_deploy_not_frameworks))))
        paasta_print(
            "  You should probably delete these deploy.yaml entries if they are unused."
        )
        the_return = False

    if the_return is True:
        paasta_print(
            success("All entries in deploy.yaml correspond to a paasta instance")
        )
        for it in INSTANCE_TYPES:
            if len(framework_deploy_groups[it]) > 0:
                paasta_print(
                    success(
                        "All %s instances have a corresponding deploy.yaml entry" % it
                    )
                )
    return the_return