Files
computer-playbook/utils/install/lint/mbake.py
T
kevinveenbirkenbachandClaude Opus 5 eda9474e37 test(lint): refuse a default in os.environ.get, and resolve the 25 sites
The deploy decides what ADAPTER_PORT or OPENWEBUI_ADMIN_NAME is and
writes it into the environment. A default in the reader is a second place
that value lives, and it is the one nobody greps for. os.environ["X"]
fails loudly on a missing key, which is the behaviour a misconfiguration
deserves.

Empty values stay free, because they add no second source and only say
absent: "", None, False, 0, the empty containers, and the "[]"/"{}" a
json.loads reader hands an absent variable. A default that is itself an
environ.get is free too, since it reads the one source again under
another key; a literal ending such a chain is still reported. Detection
runs on the parsed tree, so a call split across lines reads the same.

Five sites were real duplication and lost their default: the adapter
port, openwebui's admin name (a role that runs as a bot user), odoo's
OIDC uid field, seaweedfs' public-primary flag, and the swarm hosts
entry IP. Nineteen carry a nocheck naming why the value is not the
deploy's: contributor tooling whose default is the only source, test
scaffolding that writes the file it names, and two readers of
CA_TRUST_CERT_EXTRA_HOST, which nothing in the repo sets.

utils/diagnostics/container.py resolves without a marker: RESCUE_DEPTH is
a recursion base case, and the integer 0 says what the string "0" said.
The file sits exactly at the 500-line cap, so a comment line was not
available.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-10-14 00:26:55 +02:00

20 lines
668 B
Python

"""Install mbake via pip."""
from __future__ import annotations
import os
from utils.install.pip import install_pip_pkg
from utils.install.primitives import log, which
def ensure() -> None:
if which("mbake"):
return
log("Missing command 'mbake'. Installing via pip.")
# nocheck: environ-get-default the fallback is the package name this installer exists for; MBAKE_PIP_SPEC is the contributor's way to pin a version or a fork, and no deploy sets it
spec = os.environ.get("MBAKE_PIP_SPEC", "mbake")
install_pip_pkg(spec)
if not which("mbake"):
raise RuntimeError("Command 'mbake' is still unavailable after installation.")