feat(gateway): real FreeBSD rc.d detection in get_gateway_runtime_snapshot
Some checks failed
Docker Build and Publish / build-amd64 (pull_request) Has been cancelled
Typecheck / typecheck (apps/shared) (pull_request) Has been cancelled
Typecheck / typecheck (ui-tui) (pull_request) Has been cancelled
Typecheck / typecheck (web) (pull_request) Has been cancelled
Docker Build and Publish / build-arm64 (pull_request) Has been cancelled
Contributor Attribution Check / check-attribution (pull_request) Has been cancelled
History Check / check-common-ancestor (pull_request) Has been cancelled
Lint (ruff + ty) / ruff + ty diff (pull_request) Has been cancelled
Lint (ruff + ty) / ruff enforcement (blocking) (pull_request) Has been cancelled
Lint (ruff + ty) / Windows footguns (blocking) (pull_request) Has been cancelled
Nix / nix (macos-latest) (pull_request) Has been cancelled
Nix / nix (ubuntu-latest) (pull_request) Has been cancelled
Supply Chain Audit / changes (pull_request) Has been cancelled
Tests / test (1) (pull_request) Has been cancelled
Tests / test (2) (pull_request) Has been cancelled
Tests / test (3) (pull_request) Has been cancelled
Tests / test (4) (pull_request) Has been cancelled
Typecheck / typecheck (apps/desktop) (pull_request) Has been cancelled
Tests / test (5) (pull_request) Has been cancelled
Tests / test (6) (pull_request) Has been cancelled
Tests / e2e (pull_request) Has been cancelled
Typecheck / typecheck (apps/bootstrap-installer) (pull_request) Has been cancelled
Docker Build and Publish / merge (pull_request) Has been cancelled
Supply Chain Audit / Scan PR for critical supply chain risks (pull_request) Has been cancelled
Supply Chain Audit / Check PyPI dependency upper bounds (pull_request) Has been cancelled
Tests / save-durations (pull_request) Has been cancelled
Some checks failed
Docker Build and Publish / build-amd64 (pull_request) Has been cancelled
Typecheck / typecheck (apps/shared) (pull_request) Has been cancelled
Typecheck / typecheck (ui-tui) (pull_request) Has been cancelled
Typecheck / typecheck (web) (pull_request) Has been cancelled
Docker Build and Publish / build-arm64 (pull_request) Has been cancelled
Contributor Attribution Check / check-attribution (pull_request) Has been cancelled
History Check / check-common-ancestor (pull_request) Has been cancelled
Lint (ruff + ty) / ruff + ty diff (pull_request) Has been cancelled
Lint (ruff + ty) / ruff enforcement (blocking) (pull_request) Has been cancelled
Lint (ruff + ty) / Windows footguns (blocking) (pull_request) Has been cancelled
Nix / nix (macos-latest) (pull_request) Has been cancelled
Nix / nix (ubuntu-latest) (pull_request) Has been cancelled
Supply Chain Audit / changes (pull_request) Has been cancelled
Tests / test (1) (pull_request) Has been cancelled
Tests / test (2) (pull_request) Has been cancelled
Tests / test (3) (pull_request) Has been cancelled
Tests / test (4) (pull_request) Has been cancelled
Typecheck / typecheck (apps/desktop) (pull_request) Has been cancelled
Tests / test (5) (pull_request) Has been cancelled
Tests / test (6) (pull_request) Has been cancelled
Tests / e2e (pull_request) Has been cancelled
Typecheck / typecheck (apps/bootstrap-installer) (pull_request) Has been cancelled
Docker Build and Publish / merge (pull_request) Has been cancelled
Supply Chain Audit / Scan PR for critical supply chain risks (pull_request) Has been cancelled
Supply Chain Audit / Check PyPI dependency upper bounds (pull_request) Has been cancelled
Tests / save-durations (pull_request) Has been cancelled
`hermes status` reported the gateway as "manual process" on FreeBSD because
get_gateway_runtime_snapshot() only had systemd/launchd branches and fell
through. Add a proper FreeBSD rc.d path so status reports real state:
- is_freebsd() helper (sys.platform.startswith("freebsd")).
- _freebsd_rcd_service_path() + _probe_freebsd_service_running() — probes the
hermes_daemon rc.d service via `service hermes_daemon onestatus` (reports
running regardless of the rcvar enable flag; works without root; fail-safe on
timeout/missing binary), mirroring the launchd probe.
- snapshot branch: manager="rc.d (hermes_daemon)", service_installed (rc.d file
present), service_running (onestatus), service_scope="rc.d".
This is the deeper fix behind the status.py fallback message (PR #6). Not changed:
get_managed_gateway_pids() restart-drain path (systemd/launchd only) — gateway
liveness already works via find_gateway_pids(); rc.d restart-drain is a separate
follow-up.
py_compile clean; wiring + branch-ordering verified.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
f12e8c13f2
commit
4e7a55704d
1 changed files with 37 additions and 0 deletions
|
|
@ -1079,6 +1079,30 @@ def _probe_launchd_service_running() -> bool:
|
|||
return result.returncode == 0
|
||||
|
||||
|
||||
_FREEBSD_RCD_SERVICE = "hermes_daemon"
|
||||
|
||||
|
||||
def _freebsd_rcd_service_path() -> Path:
|
||||
return Path("/usr/local/etc/rc.d") / _FREEBSD_RCD_SERVICE
|
||||
|
||||
|
||||
def _probe_freebsd_service_running() -> bool:
|
||||
if not _freebsd_rcd_service_path().exists():
|
||||
return False
|
||||
try:
|
||||
# `onestatus` reports running state regardless of the rcvar enable flag,
|
||||
# and works without root.
|
||||
result = subprocess.run(
|
||||
["service", _FREEBSD_RCD_SERVICE, "onestatus"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=10,
|
||||
)
|
||||
except (subprocess.TimeoutExpired, FileNotFoundError, OSError):
|
||||
return False
|
||||
return result.returncode == 0
|
||||
|
||||
|
||||
def get_gateway_runtime_snapshot(system: bool = False) -> GatewayRuntimeSnapshot:
|
||||
"""Return a unified view of gateway liveness for the current profile."""
|
||||
gateway_pids = tuple(find_gateway_pids())
|
||||
|
|
@ -1128,6 +1152,15 @@ def get_gateway_runtime_snapshot(system: bool = False) -> GatewayRuntimeSnapshot
|
|||
service_scope="launchd",
|
||||
)
|
||||
|
||||
if is_freebsd():
|
||||
return GatewayRuntimeSnapshot(
|
||||
manager=f"rc.d ({_FREEBSD_RCD_SERVICE})",
|
||||
service_installed=_freebsd_rcd_service_path().exists(),
|
||||
service_running=_probe_freebsd_service_running(),
|
||||
gateway_pids=gateway_pids,
|
||||
service_scope="rc.d",
|
||||
)
|
||||
|
||||
return GatewayRuntimeSnapshot(
|
||||
manager="manual process",
|
||||
gateway_pids=gateway_pids,
|
||||
|
|
@ -1369,6 +1402,10 @@ def is_macos() -> bool:
|
|||
return sys.platform == "darwin"
|
||||
|
||||
|
||||
def is_freebsd() -> bool:
|
||||
return sys.platform.startswith("freebsd")
|
||||
|
||||
|
||||
def is_windows() -> bool:
|
||||
return sys.platform == "win32"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue