Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent display full logs when browsing a deployment #497

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tdp/cli/commands/browse.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def _print_deployment(deployment: DeploymentLog) -> None:
click.echo("Deployment does not exist.")
return

print_deployment(deployment)
print_deployment(deployment, filter_out=["logs"])


def _print_operations(operations: list[OperationLog]) -> None:
Expand Down
10 changes: 6 additions & 4 deletions tdp/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os
from collections.abc import Callable
from pathlib import Path
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Optional

import click
from click.decorators import FC
Expand Down Expand Up @@ -133,15 +133,17 @@ def preview(func: FC) -> FC:
)(func)


def print_deployment(deployment: DeploymentLog) -> None:
def print_deployment(
deployment: DeploymentLog, /, *, filter_out: Optional[list[str]] = None
) -> None:
# Print general deployment infos
click.secho("Deployment details", bold=True)
click.echo(print_object(deployment.to_dict()))
click.echo(print_object(deployment.to_dict(filter_out=filter_out)))

# Print deployment operations
click.secho("\nOperations", bold=True)
print_table(
[o.to_dict() for o in deployment.operations],
[o.to_dict(filter_out=filter_out) for o in deployment.operations],
)


Expand Down