From ff052e53e39470182a39200dca381fd3bfb6b97a Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Thu, 21 Nov 2024 17:02:15 +0100 Subject: [PATCH] Clan-cli/api: list external modules --- lib/inventory/schemas/default.nix | 8 -------- pkgs/clan-cli/clan_cli/api/modules.py | 6 +++--- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/inventory/schemas/default.nix b/lib/inventory/schemas/default.nix index 6918368a5..f6a6660a1 100644 --- a/lib/inventory/schemas/default.nix +++ b/lib/inventory/schemas/default.nix @@ -2,17 +2,10 @@ self, self', pkgs, - lib, ... }: let - # { mName :: { roleName :: Options } } - # getModulesSchema = modules: lib.mapAttrs ( - # _moduleName: rolesOptions: - # lib.mapAttrs (_roleName: options: jsonWithoutHeader.parseOptions options { }) rolesOptions - # ) (self.lib.evalClanModulesWithRoles modules); - modulesSchema = self.lib.modules.getModulesSchema self.clanModules; jsonLib = self.lib.jsonschema { inherit includeDefaults; }; @@ -49,7 +42,6 @@ in frontMatterSchema inventorySchema modulesSchema - getModulesSchema renderSchema inventory-schema-abstract ; diff --git a/pkgs/clan-cli/clan_cli/api/modules.py b/pkgs/clan-cli/clan_cli/api/modules.py index 746afc628..d09da67c5 100644 --- a/pkgs/clan-cli/clan_cli/api/modules.py +++ b/pkgs/clan-cli/clan_cli/api/modules.py @@ -145,7 +145,7 @@ class ModuleInfo: def get_modules(base_path: str) -> dict[str, str]: cmd = nix_eval( [ - f"{base_path}#clanInternals.clanModules", + f"{base_path}#clanInternals.inventory.modules", "--json", ] ) @@ -153,11 +153,11 @@ def get_modules(base_path: str) -> dict[str, str]: proc = run_no_stdout(cmd) res = proc.stdout.strip() except ClanCmdError as e: - msg = "clanInternals might not have clanModules attributes" + msg = "clanInternals might not have inventory.modules attributes" raise ClanError( msg, location=f"list_modules {base_path}", - description="Evaluation failed on clanInternals.clanModules attribute", + description="Evaluation failed on clanInternals.inventory.modules attribute", ) from e modules: dict[str, str] = json.loads(res) return modules