Inventory: docs fixup
This commit is contained in:
@@ -212,6 +212,9 @@ For more information, see the [inventory guide](../../guides/inventory.md).
|
||||
|
||||
clan_modules_descr = """Clan modules are [NixOS modules](https://wiki.nixos.org/wiki/NixOS_modules) which have been enhanced with additional features provided by Clan, with certain option types restricted to enable configuration through a graphical interface.
|
||||
|
||||
!!! note "🔹 = [inventory](../../guides/inventory.md) supported
|
||||
Modules with this indicator support the [inventory](../../guides/inventory.md) feature.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
@@ -246,15 +249,6 @@ def produce_clan_modules_docs() -> None:
|
||||
with Path(CLAN_MODULES).open() as f:
|
||||
links: dict[str, str] = json.load(f)
|
||||
|
||||
# with open(CLAN_MODULES_READMES) as readme:
|
||||
# readme_map: dict[str, str] = json.load(readme)
|
||||
|
||||
# with open(CLAN_MODULES_META) as f:
|
||||
# meta_map: dict[str, Any] = json.load(f)
|
||||
# print(meta_map)
|
||||
|
||||
# {'borgbackup': '/nix/store/hi17dwgy7963ddd4ijh81fv0c9sbh8sw-options.json', ... }
|
||||
|
||||
modules_index = "# Modules Overview\n\n"
|
||||
modules_index += clan_modules_descr
|
||||
modules_index += "## Overview\n\n"
|
||||
|
||||
@@ -12,19 +12,6 @@ This guide will walk you through setting up a backup service, where the inventor
|
||||
|
||||
Stabilizing the API is a priority.
|
||||
|
||||
## Categories
|
||||
|
||||
<div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;">
|
||||
<!-- Chip 1 -->
|
||||
<div style="background-color: #F5B7B1; color: white; padding: 10px; border-radius: 20px; text-align: center;">
|
||||
Light Coral
|
||||
</div>
|
||||
<!-- Chip 2 -->
|
||||
<div style="background-color: #85C1E9; color: white; padding: 10px; border-radius: 20px; text-align: center;">
|
||||
Baby Blue
|
||||
</div>
|
||||
</div>
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- [x] [Add machines](./add-machines.md) to your clan.
|
||||
|
||||
@@ -106,10 +106,23 @@ def extract_frontmatter(readme_content: str, err_scope: str) -> tuple[Frontmatte
|
||||
)
|
||||
|
||||
|
||||
def has_inventory_feature(module_path: Path) -> bool:
|
||||
readme_file = module_path / "README.md"
|
||||
if not readme_file.exists():
|
||||
return False
|
||||
with readme_file.open() as f:
|
||||
readme = f.read()
|
||||
frontmatter, _ = extract_frontmatter(readme, f"{module_path}")
|
||||
return "inventory" in frontmatter.features
|
||||
|
||||
|
||||
def get_roles(module_path: Path) -> None | list[str]:
|
||||
if not has_inventory_feature(module_path):
|
||||
return None
|
||||
|
||||
roles_dir = module_path / "roles"
|
||||
if not roles_dir.exists() or not roles_dir.is_dir():
|
||||
return None
|
||||
return ["default"]
|
||||
|
||||
return [
|
||||
role.stem # filename without .nix extension
|
||||
|
||||
Reference in New Issue
Block a user