From 90d9dbb242bdaf17b96c2bcb7143f01e5f11182a Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Mon, 26 May 2025 17:50:18 +0200 Subject: [PATCH 1/2] Refactor(lib/inventory): move machine actions into clan_lib/machines/actions.py --- pkgs/clan-cli/clan_cli/machines/list.py | 2 +- .../machines/inventory.py => clan_lib/machines/actions.py} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename pkgs/clan-cli/{clan_cli/machines/inventory.py => clan_lib/machines/actions.py} (100%) diff --git a/pkgs/clan-cli/clan_cli/machines/list.py b/pkgs/clan-cli/clan_cli/machines/list.py index 324b63cc6..cff1eb1e3 100644 --- a/pkgs/clan-cli/clan_cli/machines/list.py +++ b/pkgs/clan-cli/clan_cli/machines/list.py @@ -9,13 +9,13 @@ from clan_lib.api.modules import parse_frontmatter from clan_lib.dirs import specific_machine_dir from clan_lib.errors import ClanError from clan_lib.flake import Flake +from clan_lib.machines.actions import get_machine from clan_lib.machines.machines import Machine from clan_lib.nix_models.inventory import Machine as InventoryMachine from clan_lib.persist.inventory_store import InventoryStore from clan_cli.completions import add_dynamic_completer, complete_tags from clan_cli.machines.hardware import HardwareConfig -from clan_cli.machines.inventory import get_machine log = logging.getLogger(__name__) diff --git a/pkgs/clan-cli/clan_cli/machines/inventory.py b/pkgs/clan-cli/clan_lib/machines/actions.py similarity index 100% rename from pkgs/clan-cli/clan_cli/machines/inventory.py rename to pkgs/clan-cli/clan_lib/machines/actions.py From 2312a65c17d730b9b54485d46f9e707252232e1a Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Mon, 26 May 2025 17:52:46 +0200 Subject: [PATCH 2/2] Chore: rename secrets.get_machine to avoid ambiguity --- pkgs/clan-cli/clan_cli/secrets/machines.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/clan-cli/clan_cli/secrets/machines.py b/pkgs/clan-cli/clan_cli/secrets/machines.py index 065eceab1..909fd7274 100644 --- a/pkgs/clan-cli/clan_cli/secrets/machines.py +++ b/pkgs/clan-cli/clan_cli/secrets/machines.py @@ -49,7 +49,7 @@ def remove_machine(flake_dir: Path, name: str) -> None: ) -def get_machine(flake_dir: Path, name: str) -> str: +def get_machine_pubkey(flake_dir: Path, name: str) -> str: key = read_key(sops_machines_folder(flake_dir) / name) return key.pubkey @@ -120,7 +120,7 @@ def get_command(args: argparse.Namespace) -> None: if args.flake is None: msg = "Could not find clan flake toplevel directory" raise ClanError(msg) - print(get_machine(args.flake.path, args.machine)) + print(get_machine_pubkey(args.flake.path, args.machine)) def remove_command(args: argparse.Namespace) -> None: