From e889528ca0f3b9b423ac4c75c4385f212d1dfcda Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Fri, 13 Sep 2024 17:18:12 +0200 Subject: [PATCH] ClanModules: make all module available to inventory --- docs/nix/render_options/__init__.py | 8 ++++---- lib/inventory/build-inventory/default.nix | 2 ++ lib/inventory/interface-to-schema.nix | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/nix/render_options/__init__.py b/docs/nix/render_options/__init__.py index fb0a5b337..3e11ae118 100644 --- a/docs/nix/render_options/__init__.py +++ b/docs/nix/render_options/__init__.py @@ -28,7 +28,7 @@ import os from pathlib import Path from typing import Any -from clan_cli.api.modules import Frontmatter, extract_frontmatter, get_roles +from clan_cli.api.modules import Frontmatter, extract_frontmatter from clan_cli.errors import ClanError # Get environment variables @@ -277,9 +277,9 @@ def produce_clan_modules_docs() -> None: output += f"{readme_content}\n" # get_roles(str) -> list[str] | None - roles = get_roles(CLAN_CORE_PATH / "clanModules" / module_name) - if roles: - output += render_roles(roles, module_name) + # roles = get_roles(CLAN_CORE_PATH / "clanModules" / module_name) + # if roles: + # output += render_roles(roles, module_name) output += module_usage(module_name) diff --git a/lib/inventory/build-inventory/default.nix b/lib/inventory/build-inventory/default.nix index 1ae86a151..b70cea859 100644 --- a/lib/inventory/build-inventory/default.nix +++ b/lib/inventory/build-inventory/default.nix @@ -135,6 +135,8 @@ let in if builtins.pathExists path then path + else if role == "default" then + { } else throw "Module doesn't have role: '${role}'. Path: ${path} not found." ) inverseRoles.${machineName} or [ ]; diff --git a/lib/inventory/interface-to-schema.nix b/lib/inventory/interface-to-schema.nix index 91221b954..709a0d2d7 100644 --- a/lib/inventory/interface-to-schema.nix +++ b/lib/inventory/interface-to-schema.nix @@ -96,7 +96,7 @@ let let roles = getRoles self.clanModules.${moduleName}; in - if roles == null then [ ] else roles; + if roles == null then [ "default" ] else roles; moduleServices = lib.mapAttrs moduleToService ( lib.filterAttrs (n: _v: rolesOf n != [ ]) modulesSchema );