Merge pull request 'clan-cli: Refactor the API to use the Flake object' (#3531) from Qubasa/clan-core:replace_machine_name_with_machine_obj into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3531
This commit is contained in:
Mic92
2025-05-07 13:21:13 +00:00
31 changed files with 168 additions and 136 deletions

View File

@@ -16,7 +16,7 @@
# (subdir / ".clan-flake").touch()
# assert _get_clan_flake_toplevel() == subdir
from clan_cli.dirs import clan_key_safe, vm_state_dir
from clan_cli.clan_dirs import clan_key_safe, vm_state_dir
def test_clan_key_safe() -> None:

View File

@@ -1,4 +1,5 @@
import pytest
from clan_cli.flake import Flake
from clan_cli.inventory import load_inventory_json
from clan_cli.secrets.folders import sops_machines_folder
from clan_cli.tests import fixtures_flakes
@@ -24,7 +25,7 @@ def test_machine_subcommands(
]
)
inventory: dict = dict(load_inventory_json(str(test_flake_with_core.path)))
inventory: dict = dict(load_inventory_json(Flake(str(test_flake_with_core.path))))
assert "machine1" in inventory["machines"]
assert "service" not in inventory
@@ -40,7 +41,7 @@ def test_machine_subcommands(
["machines", "delete", "--flake", str(test_flake_with_core.path), "machine1"]
)
inventory_2: dict = dict(load_inventory_json(str(test_flake_with_core.path)))
inventory_2: dict = dict(load_inventory_json(Flake(str(test_flake_with_core.path))))
assert "machine1" not in inventory_2["machines"]
assert "service" not in inventory_2

View File

@@ -88,7 +88,7 @@ def test_add_module_to_inventory(
}
}
set_inventory(inventory, base_path, "Add borgbackup service")
set_inventory(inventory, Flake(str(base_path)), "Add borgbackup service")
# cmd = ["facts", "generate", "--flake", str(test_flake_with_core.path), "machine1"]
cmd = [