cli: fix machines update not outputting stdout of nixos-rebuild

This commit is contained in:
Michael Hoang
2025-05-10 16:57:00 +10:00
parent b306c748b8
commit 8a755fff8c

View File

@@ -10,7 +10,7 @@ from contextlib import ExitStack
from clan_lib.api import API from clan_lib.api import API
from clan_cli.async_run import AsyncContext, AsyncOpts, AsyncRuntime, is_async_cancelled from clan_cli.async_run import AsyncContext, AsyncOpts, AsyncRuntime, is_async_cancelled
from clan_cli.cmd import MsgColor, RunOpts, run from clan_cli.cmd import Log, MsgColor, RunOpts, run
from clan_cli.colors import AnsiColor from clan_cli.colors import AnsiColor
from clan_cli.completions import ( from clan_cli.completions import (
add_dynamic_completer, add_dynamic_completer,
@@ -182,16 +182,16 @@ def deploy_machine(machine: Machine) -> None:
remote_env = host.nix_ssh_env(None, local_ssh=False) remote_env = host.nix_ssh_env(None, local_ssh=False)
ret = host.run( ret = host.run(
switch_cmd, switch_cmd,
RunOpts(check=False, msg_color=MsgColor(stderr=AnsiColor.DEFAULT)), RunOpts(
check=False,
log=Log.BOTH,
msg_color=MsgColor(stderr=AnsiColor.DEFAULT),
needs_user_terminal=True,
),
extra_env=remote_env, extra_env=remote_env,
become_root=become_root, become_root=become_root,
) )
# Last output line (config store path) is printed to stdout instead of stderr
lines = ret.stdout.splitlines()
if lines:
print(lines[-1])
if is_async_cancelled(): if is_async_cancelled():
return return
@@ -206,6 +206,7 @@ def deploy_machine(machine: Machine) -> None:
ret = host.run( ret = host.run(
test_cmd if is_mobile else switch_cmd, test_cmd if is_mobile else switch_cmd,
RunOpts( RunOpts(
log=Log.BOTH,
msg_color=MsgColor(stderr=AnsiColor.DEFAULT), msg_color=MsgColor(stderr=AnsiColor.DEFAULT),
needs_user_terminal=True, needs_user_terminal=True,
), ),