mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 02:54:26 +00:00
Relocates `cli/meta/{ports,networks/suggest}` to
`cli/contributing/network/{ports,address/suggest}` so port and subnet
allocators live alongside the rest of the contributor-side tooling
(mirror, update, changelog) instead of `meta`. Mirrors the tests
into `tests/unit/cli/contributing/network/` and renames the contract
docs to `docs/contributing/tools/network/{port,address}.md`. Prog
names update from `cli meta ports suggest` / `cli meta networks
suggest` to `cli contributing network ports suggest` / `cli
contributing network address suggest`; the corresponding lint
references and `utils.meta.scan` docstring follow.
Adds a third subcommand: `cli contributing network diagnose`
(stdlib-only DNS / TCP / TLS / PMTU probe against the standard
infrastructure hosts plus interface MTU, `/etc/resolv.conf`,
`/etc/hosts`, proxy env, CA-bundle summaries). Split across `cli.py`
(orchestration), `config.py` (SPOT for hosts / per-distro install
commands), `format.py` (output + subprocess helpers), `tools.py`
(distro-aware auto-install of `iputils-ping` + `iproute2`),
`report.py` (system-info dumps + IPv6-default-route detection), and
`probes.py` (per-host probes). Exposed as `make debug-network`.
Companion `docs/contributing/actions/debugging/network.md` absorbs
the diagnose-tool walkthrough (incl. how to read MTU-induced TLS
handshake timeouts) so the merged page covers DNS / MTU / IPv6 /
connectivity end-to-end.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
46 lines
1.2 KiB
Python
46 lines
1.2 KiB
Python
"""Diagnose CLI orchestration."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import socket
|
|
|
|
from cli.contributing.network.diagnose.config import DEFAULT_HOSTS, EXTRA_HOSTS_ENV
|
|
from cli.contributing.network.diagnose.format import section
|
|
from cli.contributing.network.diagnose.probes import per_host_check
|
|
from cli.contributing.network.diagnose.report import (
|
|
has_ipv6_default_route,
|
|
show_ca_bundle,
|
|
show_hosts,
|
|
show_identity,
|
|
show_iface_routes,
|
|
show_proxies,
|
|
show_resolv,
|
|
)
|
|
from cli.contributing.network.diagnose.tools import ensure_tools
|
|
|
|
|
|
def resolve_hosts() -> list[str]:
|
|
extra = os.environ.get(EXTRA_HOSTS_ENV, "").split()
|
|
return [*DEFAULT_HOSTS, *extra]
|
|
|
|
|
|
def main() -> int:
|
|
show_identity()
|
|
ensure_tools()
|
|
show_iface_routes()
|
|
show_resolv()
|
|
show_hosts()
|
|
show_proxies()
|
|
show_ca_bundle()
|
|
|
|
hosts = resolve_hosts()
|
|
per_host_check(hosts, socket.AF_INET, "IPv4")
|
|
if socket.has_ipv6 and has_ipv6_default_route():
|
|
per_host_check(hosts, socket.AF_INET6, "IPv6")
|
|
else:
|
|
section("IPv6")
|
|
print(" [SKIP] no IPv6 default route on this host (bridge is IPv4-only)")
|
|
section("done")
|
|
return 0
|