_common
_common
¶
Shared building blocks for the per-verb command modules.
Small, dependency-light helpers reused across
control,
observe, and
launch: the argument-value splitter, the
container-argument definitions, the extras marker maps read by
needs_container /
standalone_only, and the
version/environment formatting used by the status-style verbs.
CONTAINER_ARG = ArgDef(name='container', help='Container name or ID')
module-attribute
¶
PROFILES_ARG = ArgDef(name='--profiles', type=csv_list, help="Profiles to apply instead of default_profiles from config.yml (comma-separated, e.g. 'dev-standard,dev-python')")
module-attribute
¶
CONTAINER_ID_ARG = ArgDef(name='--container-id', required=True, help='Full podman container UUID — routes hub events to the per-container supervisor socket')
module-attribute
¶
NEEDS_CTR = {'needs_container': True}
module-attribute
¶
STANDALONE = {'standalone_only': True}
module-attribute
¶
NEEDS_CTR_STANDALONE = {'needs_container': True, 'standalone_only': True}
module-attribute
¶
csv_list(value)
¶
Split a comma-separated CLI value into a list, stripping whitespace.
Used as ArgDef.type for multi-value optional flags so they don't
rely on argparse's greedy nargs="+" (which silently slurps the
following positional, turning --profiles a b mycontainer into
profiles=["a","b","mycontainer"]). Comma-separated single-value
matches podman's convention (--cap-add=A,B,C).
Source code in src/terok_shield/verbs/_common.py
format_version(v)
¶
format_seconds(seconds)
¶
Render a countdown in whole seconds the way nft spells durations (4m59s, 1h).
Zero units are left out, so an hour reads 1h rather than 1h0m0s;
nothing at all left reads 0s — the last second of a window.
Source code in src/terok_shield/verbs/_common.py
print_env_hint(env)
¶
Print human-readable environment issues and setup hint.
Source code in src/terok_shield/verbs/_common.py
print_rotation_risk(shield, posture)
¶
Print, to stderr, the names the container's DNS tier pins that matter in posture.
Read from the bundle, never the audit log — the warning reaches the
operator with audit off too — and written to stderr, so prepare's
eval-ready stdout stays exactly the podman flags.