From d8b69ec883e694e980d01e661e95c0b9426b703c Mon Sep 17 00:00:00 2001 From: Qubasa Date: Tue, 3 Oct 2023 14:38:51 +0200 Subject: [PATCH] Added newlines against buffering for log streaming. Fixed cli --- pkgs/clan-cli/clan_cli/vms/create.py | 4 ++-- pkgs/clan-cli/clan_cli/webui/routers/vms.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/clan-cli/clan_cli/vms/create.py b/pkgs/clan-cli/clan_cli/vms/create.py index 78f441d55..c7b815eb6 100644 --- a/pkgs/clan-cli/clan_cli/vms/create.py +++ b/pkgs/clan-cli/clan_cli/vms/create.py @@ -37,8 +37,8 @@ def create(args: argparse.Namespace) -> None: stream = asyncio.run(vms.get_vm_logs(uuid)) for line in read_stream_response(stream): - print(line) - + print(line, end="") + print("") def register_create_parser(parser: argparse.ArgumentParser) -> None: parser.add_argument("machine", type=str) diff --git a/pkgs/clan-cli/clan_cli/webui/routers/vms.py b/pkgs/clan-cli/clan_cli/webui/routers/vms.py index 9b581bda5..29c838f4e 100644 --- a/pkgs/clan-cli/clan_cli/webui/routers/vms.py +++ b/pkgs/clan-cli/clan_cli/webui/routers/vms.py @@ -164,7 +164,7 @@ async def get_vm_logs(uuid: UUID) -> StreamingResponse: @router.post("/api/vms/create") async def create_vm( - vm: Annotated[VmConfig, Body()], background_tasks: BackgroundTasks + vm: Annotated[VmConfig, Body()] ) -> VmCreateResponse: flake_attrs = await get_attrs(vm.flake_url) if vm.flake_attr not in flake_attrs: