fix(docs-ci): unblock build by tolerating "?" placeholders in hardware frontmatter
mf00.md used bare ? in YAML (a complex-key indicator), breaking gen_overview.py. Quoted the placeholders and taught fmt_cpu/fmt_ram/fmt_storage/fmt_nic to render string values literally so unknown specs show as "?" in both the per-host Specs table and the hardware index. Also regenerates docs/hardware/index.md to clear the accumulated drift (mf02 16 GB, mf04 entry, mf00 custom). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c50a3b5acf
commit
41c4834dbd
3 changed files with 24 additions and 15 deletions
|
|
@ -7,7 +7,8 @@ _Auto-generated from `docs/hardware/*.md` — do not edit by hand. Run `make doc
|
|||
| Hostname | Model | Location | CPU | RAM | Storage | NIC | Status |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| [makerfloss.eu](makerfloss.eu.md) | Hetzner CX22 | Hetzner HEL1 (cloud) | AMD EPYC (shared vCPU) · 2c | 4 GB | 40 GB NVME | 1 GbE | in-use |
|
||||
| [mf00](mf00.md) | Fractal | The pile | Intel Core i5-6600 @3.30GHz · 4c | 32 GB | 256 GB SSD + 1 TB HDD + 1 TB HDD + 1 TB NVME | 1/2.5/10 GbE | staging |
|
||||
| [mf00](mf00.md) | custom | The pile | ? | ? | ? | ? | staging |
|
||||
| [mf01](mf01.md) | HP Elitedesk 800 G4 TWR | The pile | Intel Core i5-8500 @ 3.00GHz · 6c | 8 GB | 40 GB NVME | 1 GbE | staging |
|
||||
| [mf02](mf02.md) | HP Elitedesk 800 G4 TWR | The pile | Intel Core i5-8500 @ 3.00GHz · 6c | 8 GB | 40 GB NVME | 1 GbE | staging |
|
||||
| [mf03](mf03.md) | VisionComputer | The pile | Intel Core i5-3570K @ 3.40GHz · 4c | 8 GB | 500 GB HDD | 1 GbE | staging |
|
||||
| [mf02](mf02.md) | HP Elitedesk 800 G4 TWR | The pile | Intel Core i5-8500 @ 3.00GHz · 6c | 16 GB | 40 GB NVME | 1 GbE | staging |
|
||||
| [mf03](mf03.md) | custom | The pile | Intel Core i5-3570K @ 3.40GHz · 4c | 8 GB | 500 GB HDD | 1 GbE | staging |
|
||||
| [mf04](mf04.md) | custom | The pile | Intel Core i5-3570K @ 3.40GHz · 4c | 8 GB | 500 GB HDD | 1 GbE | staging |
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ kind: server
|
|||
status: staging
|
||||
model: custom
|
||||
location: The pile
|
||||
cpu: ?
|
||||
cpu_cores: ?
|
||||
cpu_threads: ?
|
||||
ram_gb: ?
|
||||
storage: ?
|
||||
nic_gbps: ?
|
||||
cpu: "?"
|
||||
cpu_cores: "?"
|
||||
cpu_threads: "?"
|
||||
ram_gb: "?"
|
||||
storage: "?"
|
||||
nic_gbps: "?"
|
||||
---
|
||||
|
||||
## Notes
|
||||
|
|
|
|||
|
|
@ -64,20 +64,24 @@ def validate(path: Path, fm: dict, cfg: dict) -> None:
|
|||
|
||||
|
||||
def fmt_cpu(fm: dict) -> str:
|
||||
model = fm.get("cpu", "")
|
||||
model = fm.get("cpu") or ""
|
||||
cores = fm.get("cpu_cores")
|
||||
threads = fm.get("cpu_threads")
|
||||
suffix = ""
|
||||
if cores and threads and threads != cores:
|
||||
if isinstance(cores, int) and isinstance(threads, int) and threads != cores:
|
||||
suffix = f" · {cores}c/{threads}t"
|
||||
elif cores:
|
||||
elif isinstance(cores, int):
|
||||
suffix = f" · {cores}c"
|
||||
return (model + suffix).strip()
|
||||
return (str(model) + suffix).strip()
|
||||
|
||||
|
||||
def fmt_ram(fm: dict) -> str:
|
||||
n = fm.get("ram_gb")
|
||||
return f"{n} GB" if isinstance(n, int) else ""
|
||||
if isinstance(n, int):
|
||||
return f"{n} GB"
|
||||
if isinstance(n, str) and n:
|
||||
return n
|
||||
return ""
|
||||
|
||||
|
||||
def _fmt_size_gb(n: int) -> str:
|
||||
|
|
@ -100,6 +104,8 @@ def fmt_storage(fm: dict) -> str:
|
|||
elif t:
|
||||
parts.append(t)
|
||||
return " + ".join(parts)
|
||||
if isinstance(drives, str) and drives:
|
||||
return drives
|
||||
|
||||
n = fm.get("storage_gb")
|
||||
t = fm.get("storage_type", "").upper() if fm.get("storage_type") else ""
|
||||
|
|
@ -110,8 +116,10 @@ def fmt_storage(fm: dict) -> str:
|
|||
|
||||
def fmt_nic(fm: dict) -> str:
|
||||
g = fm.get("nic_gbps")
|
||||
if g is None:
|
||||
if g is None or g == "":
|
||||
return ""
|
||||
if isinstance(g, str):
|
||||
return g
|
||||
|
||||
def one(v: float | int) -> str:
|
||||
if isinstance(v, float) and not v.is_integer():
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue