Exemplo n.º 1
0
def destroy_team(context: "Context", team_context: "TeamContext") -> None:
    _logger.debug("Stack name: %s", team_context.stack_name)
    if cfn.does_stack_exist(stack_name=context.toolkit.stack_name):
        if cfn.does_stack_exist(stack_name=team_context.stack_name):
            args: List[str] = [context.name, team_context.name]
            cdk.destroy(
                context=context,
                stack_name=team_context.stack_name,
                app_filename=os.path.join(ORBIT_CLI_ROOT, "remote_files",
                                          "cdk", "team.py"),
                args=args,
            )

        _logger.debug(
            "Team specific post_hook execute to destroy the cfn resources")
        _logger.debug(f"team_context.plugins={team_context.plugins}")
        for plugin in team_context.plugins:
            _logger.debug(f"post hook plugin={plugin}")
            if plugin.plugin_id == "custom_cfn":
                hook: plugins.HOOK_TYPE = plugins.PLUGINS_REGISTRIES.get_hook(
                    context=context,
                    team_name=team_context.name,
                    plugin_name=plugin.plugin_id,
                    hook_name="post_hook",
                )
                if hook is not None:
                    _logger.debug(
                        f"Found post hook for team {team_context.name} plugin {plugin.plugin_id}"
                    )
                    hook(plugin.plugin_id, context, team_context,
                         plugin.parameters)
Exemplo n.º 2
0
def destroy(context: "FoundationContext") -> None:
    if cfn.does_stack_exist(stack_name=cast(str, context.stack_name)):
        cleanup.foundation_remaining_dependencies(context=context)
        cleanup.delete_cert_from_iam(context=context)
        _logger.debug("Destroying Foundation...")
        cdk.destroy(
            context=context,
            stack_name=cast(str, context.stack_name),
            app_filename=os.path.join(ORBIT_CLI_ROOT, "remote_files", "cdk", "foundation.py"),
            args=[context.name],
        )
Exemplo n.º 3
0
def destroy(context: "Context") -> None:
    _logger.debug("Stack name: %s", context.env_stack_name)
    if cfn.does_stack_exist(stack_name=context.env_stack_name):
        docker.login(context=context)
        _logger.debug("DockerHub and ECR Logged in")
        ecr.cleanup_remaining_repos(env_name=context.name)
        args = [context.name]
        cdk.destroy(
            context=context,
            stack_name=context.env_stack_name,
            app_filename=os.path.join(ORBIT_CLI_ROOT, "remote_files", "cdk", "env.py"),
            args=args,
        )
        ssm.cleanup_context(env_name=context.name)
Exemplo n.º 4
0
def destroy(context: "Context") -> None:
    _logger.debug("Stack name: %s", context.env_stack_name)
    if cfn.does_stack_exist(stack_name=context.env_stack_name):
        docker.login(context=context)
        _logger.debug("DockerHub and ECR Logged in")
        _cleanup_remaining_resources(env_name=context.name)
        add_images_str, remove_images_str = _concat_images_into_args(
            context=context, add_images=[], remove_images=[])
        args = [context.name, add_images_str, remove_images_str]
        cdk.destroy(
            context=context,
            stack_name=context.env_stack_name,
            app_filename=os.path.join(ORBIT_CLI_ROOT, "remote_files", "cdk",
                                      "env.py"),
            args=args,
        )
        ssm.cleanup_context(env_name=context.name)