ClanModules: make all module available to inventory
This commit is contained in:
@@ -28,7 +28,7 @@ import os
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any
|
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
|
from clan_cli.errors import ClanError
|
||||||
|
|
||||||
# Get environment variables
|
# Get environment variables
|
||||||
@@ -277,9 +277,9 @@ def produce_clan_modules_docs() -> None:
|
|||||||
output += f"{readme_content}\n"
|
output += f"{readme_content}\n"
|
||||||
|
|
||||||
# get_roles(str) -> list[str] | None
|
# get_roles(str) -> list[str] | None
|
||||||
roles = get_roles(CLAN_CORE_PATH / "clanModules" / module_name)
|
# roles = get_roles(CLAN_CORE_PATH / "clanModules" / module_name)
|
||||||
if roles:
|
# if roles:
|
||||||
output += render_roles(roles, module_name)
|
# output += render_roles(roles, module_name)
|
||||||
|
|
||||||
output += module_usage(module_name)
|
output += module_usage(module_name)
|
||||||
|
|
||||||
|
|||||||
@@ -135,6 +135,8 @@ let
|
|||||||
in
|
in
|
||||||
if builtins.pathExists path then
|
if builtins.pathExists path then
|
||||||
path
|
path
|
||||||
|
else if role == "default" then
|
||||||
|
{ }
|
||||||
else
|
else
|
||||||
throw "Module doesn't have role: '${role}'. Path: ${path} not found."
|
throw "Module doesn't have role: '${role}'. Path: ${path} not found."
|
||||||
) inverseRoles.${machineName} or [ ];
|
) inverseRoles.${machineName} or [ ];
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ let
|
|||||||
let
|
let
|
||||||
roles = getRoles self.clanModules.${moduleName};
|
roles = getRoles self.clanModules.${moduleName};
|
||||||
in
|
in
|
||||||
if roles == null then [ ] else roles;
|
if roles == null then [ "default" ] else roles;
|
||||||
moduleServices = lib.mapAttrs moduleToService (
|
moduleServices = lib.mapAttrs moduleToService (
|
||||||
lib.filterAttrs (n: _v: rolesOf n != [ ]) modulesSchema
|
lib.filterAttrs (n: _v: rolesOf n != [ ]) modulesSchema
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user