pkgs/clan: Add machine validator with suggestion logic

Add machine validator with suggestion logic to:
- `clan machines update`
- `clan machines delete`
- `clan machines update-hardware-config`
This commit is contained in:
a-kenji
2025-06-26 16:57:51 +02:00
parent c079d6b65f
commit 3e70e30b6b
6 changed files with 213 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ import sys
from clan_lib.async_run import AsyncContext, AsyncOpts, AsyncRuntime
from clan_lib.errors import ClanError
from clan_lib.machines.machines import Machine
from clan_lib.machines.suggestions import validate_machine_names
from clan_lib.machines.update import deploy_machine
from clan_lib.nix import nix_config
from clan_lib.ssh.remote import Remote
@@ -45,6 +46,9 @@ def update_command(args: argparse.Namespace) -> None:
msg = f"No machines found with tags: {', '.join(args.tags)}"
raise ClanError(msg)
if args.machines:
validate_machine_names(args.machines, args.flake)
for machine_name in selected_machines:
machine = Machine(name=machine_name, flake=args.flake)
machines.append(machine)