clan-cli: Simplify HostKeyCheck to a Literal instead of an Enum

This commit is contained in:
Qubasa
2025-06-23 15:08:44 +02:00
parent c4b3b26fa6
commit 217f55adec
10 changed files with 19 additions and 74 deletions

View File

@@ -12,7 +12,7 @@ from clan_lib.errors import ClanCmdError, ClanError
from clan_lib.git import commit_file
from clan_lib.machines.machines import Machine
from clan_lib.nix import nix_config, nix_eval
from clan_lib.ssh.remote import HostKeyCheck, Remote
from clan_lib.ssh.remote import Remote
from clan_cli.completions import add_dynamic_completer, complete_machines
@@ -158,7 +158,7 @@ def generate_machine_hardware_info(
def update_hardware_config_command(args: argparse.Namespace) -> None:
host_key_check = HostKeyCheck.from_str(args.host_key_check)
host_key_check = args.host_key_check
machine = Machine(flake=args.flake, name=args.machine)
opts = HardwareGenerateOptions(
machine=machine,

View File

@@ -12,7 +12,7 @@ from clan_lib.cmd import Log, RunOpts, run
from clan_lib.errors import ClanError
from clan_lib.machines.machines import Machine
from clan_lib.nix import nix_shell
from clan_lib.ssh.remote import HostKeyCheck, Remote
from clan_lib.ssh.remote import Remote
from clan_cli.completions import (
add_dynamic_completer,
@@ -182,11 +182,8 @@ def install_command(args: argparse.Namespace) -> None:
password = None
machine = Machine(name=args.machine, flake=args.flake, nix_options=args.option)
host_key_check = (
HostKeyCheck.from_str(args.host_key_check)
if args.host_key_check
else HostKeyCheck.ASK
)
host_key_check = args.host_key_check
if target_host_str is not None:
target_host = Remote.from_deployment_address(
machine_name=machine.name, address=target_host_str

View File

@@ -14,7 +14,7 @@ from clan_lib.colors import AnsiColor
from clan_lib.errors import ClanError
from clan_lib.machines.machines import Machine
from clan_lib.nix import nix_command, nix_config, nix_metadata
from clan_lib.ssh.remote import HostKeyCheck, Remote
from clan_lib.ssh.remote import Remote
from clan_cli.completions import (
add_dynamic_completer,
@@ -271,7 +271,7 @@ def update_command(args: argparse.Namespace) -> None:
]
)
host_key_check = HostKeyCheck.from_str(args.host_key_check)
host_key_check = args.host_key_check
with AsyncRuntime() as runtime:
for machine in machines:
if args.target_host: