don't enable ssh askpass for now if we have a build_host set

This commit is contained in:
Jörg Thalheim
2025-07-07 16:51:22 +02:00
parent 23c1ae031f
commit 4035c25b3d
2 changed files with 7 additions and 2 deletions

View File

@@ -167,7 +167,11 @@ def run_machine_deploy(
if become_root:
host = sudo_host
remote_env = host.nix_ssh_env(control_master=False)
# Disable SSH_ASKPASS when using a build host (headless machines)
use_ssh_askpass = build_host is None
remote_env = host.nix_ssh_env(
control_master=False, use_ssh_askpass=use_ssh_askpass
)
ret = host.run(
switch_cmd,
RunOpts(

View File

@@ -296,13 +296,14 @@ class Remote:
self,
env: dict[str, str] | None = None,
control_master: bool = True,
use_ssh_askpass: bool = True,
) -> dict[str, str]:
"""Return environment variables for nix commands that use SSH."""
if env is None:
env = {}
env["NIX_SSHOPTS"] = " ".join(self.ssh_cmd_opts(control_master=control_master))
# Set SSH_ASKPASS environment variable if not using password directly
if not self.password:
if not self.password and use_ssh_askpass:
env["SSH_ASKPASS"] = SSH_ASKPASS_PATH
env["SSH_ASKPASS_REQUIRE"] = "force"
return env