clan-cli: Fix bug where --host-key-check is not applied to build-host

This commit is contained in:
Qubasa
2024-10-08 03:02:59 +02:00
parent 1090289416
commit b05fd96c0c
2 changed files with 13 additions and 5 deletions

View File

@@ -143,6 +143,9 @@ class HostKeyCheck(Enum):
description = "Choose from: " + ", ".join(HostKeyCheck.__members__)
raise ClanError(msg, description=description)
def __str__(self) -> str:
return self.name.lower()
def to_ssh_opt(self) -> list[str]:
match self:
case HostKeyCheck.STRICT:
@@ -510,6 +513,11 @@ class Host:
timeout=timeout,
)
def nix_ssh_env(self) -> dict[str, str]:
env = os.environ.copy()
env["NIX_SSHOPTS"] = " ".join(self.ssh_cmd_opts())
return env
def ssh_cmd_opts(
self,
verbose_ssh: bool = False,