diff --git a/pkgs/clan-cli/clan_cli/api/__init__.py b/pkgs/clan-cli/clan_cli/api/__init__.py index 25d3c37b8..868a977bd 100644 --- a/pkgs/clan-cli/clan_cli/api/__init__.py +++ b/pkgs/clan-cli/clan_cli/api/__init__.py @@ -107,7 +107,9 @@ API.register(open_file) self.register(wrapper) return fn - def register(self, fn: Callable[..., T]) -> Callable[..., T]: + F = TypeVar("F", bound=Callable[..., Any]) + + def register(self, fn: F) -> F: if fn.__name__ in self._registry: msg = f"Function {fn.__name__} already registered" raise ClanError(msg) diff --git a/pkgs/clan-cli/clan_cli/clan/create.py b/pkgs/clan-cli/clan_cli/clan/create.py index 84c7d0132..0481e0d4f 100644 --- a/pkgs/clan-cli/clan_cli/clan/create.py +++ b/pkgs/clan-cli/clan_cli/clan/create.py @@ -68,7 +68,7 @@ def create_clan(options: CreateOptions) -> CreateClanResponse: ) if options.initial: - init_inventory(options.directory, init=options.initial) + init_inventory(str(options.directory), init=options.initial) response = CreateClanResponse( flake_init=flake_init, diff --git a/pkgs/clan-cli/clan_cli/inventory/classes.py b/pkgs/clan-cli/clan_cli/inventory/classes.py index c0e5310ec..c66d5aa70 100644 --- a/pkgs/clan-cli/clan_cli/inventory/classes.py +++ b/pkgs/clan-cli/clan_cli/inventory/classes.py @@ -35,5 +35,5 @@ Service = dict[str, Any] @dataclass class Inventory: meta: Meta - services: Service machines: dict[str, Machine] = field(default_factory = dict) + services: dict[str, Service] = field(default_factory = dict) diff --git a/pkgs/clan-cli/clan_cli/inventory/update.sh b/pkgs/clan-cli/clan_cli/inventory/update.sh index 5d1bf5214..4debccddf 100755 --- a/pkgs/clan-cli/clan_cli/inventory/update.sh +++ b/pkgs/clan-cli/clan_cli/inventory/update.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash -jsonSchema=$(nix build .#inventory-schema --print-out-paths)/schema.json +jsonSchema=$(nix build .#inventory-schema-abstract --print-out-paths)/schema.json nix run .#classgen "$jsonSchema" "$PKG_ROOT/clan_cli/inventory/classes.py" \ No newline at end of file diff --git a/pkgs/clan-cli/clan_cli/machines/hardware.py b/pkgs/clan-cli/clan_cli/machines/hardware.py index 85538245a..dc48c6305 100644 --- a/pkgs/clan-cli/clan_cli/machines/hardware.py +++ b/pkgs/clan-cli/clan_cli/machines/hardware.py @@ -198,7 +198,7 @@ def generate_machine_hardware_info( f"HW/report: Hardware configuration for {machine_name}", ) try: - show_machine_hardware_platform(clan_dir, machine_name) + show_machine_hardware_platform(clan_dir.path, machine_name) except ClanCmdError as e: log.exception("Failed to evaluate hardware-configuration.nix") # Restore the backup file @@ -235,7 +235,7 @@ def hw_generate_command(args: argparse.Namespace) -> None: force=args.force, ) hw_info = generate_machine_hardware_info( - opts.flake, opts.machine, opts.target_host, opts.password, opts.force + opts.flake, opts.machine, opts.target_host, opts.password ) print("Successfully generated hardware information.") print(f"Target: {opts.machine} ({opts.target_host})") diff --git a/pkgs/clan-cli/flake-module.nix b/pkgs/clan-cli/flake-module.nix index 3f8399cd6..59e6bb093 100644 --- a/pkgs/clan-cli/flake-module.nix +++ b/pkgs/clan-cli/flake-module.nix @@ -124,7 +124,7 @@ classFile = "classes.py"; }; installPhase = '' - ${self'.packages.classgen}/bin/classgen ${self'.packages.inventory-schema}/schema.json b_classes.py --stop-at "Service" + ${self'.packages.classgen}/bin/classgen ${self'.packages.inventory-schema-abstract}/schema.json b_classes.py --stop-at "Service" file1=$classFile file2=b_classes.py diff --git a/pkgs/clan-cli/tests/test_modules.py b/pkgs/clan-cli/tests/test_modules.py index a8c9889f1..16bbace6e 100644 --- a/pkgs/clan-cli/tests/test_modules.py +++ b/pkgs/clan-cli/tests/test_modules.py @@ -24,7 +24,7 @@ from helpers import cli @pytest.mark.with_core def test_list_modules(test_flake_with_core: FlakeForTest) -> None: base_path = test_flake_with_core.path - modules_info = list_modules(base_path) + modules_info = list_modules(str(base_path)) assert len(modules_info.items()) > 1 # Random test for those two modules