MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / _deferred_self_stop

Function _deferred_self_stop

webapp_modern.py:2845–2868  ·  view source on GitHub ↗

Stop the ragnar.service via a systemd-run transient unit. Because Ragnar is stopping *itself*, a direct systemctl stop kills the thread before status files and config can be persisted. We use systemd-run so the stop command runs in its own cgroup — completely outside ragnar.service

(delay: int = 1)

Source from the content-addressed store, hash-verified

2843# Cache of the last peer poll. The UI reads this rather than triggering a fan-out
2844# on every page render — a 10-unit mesh must not cost 10 HTTP round trips per
2845# dashboard refresh.
2846_mesh_peer_health = {}
2847_mesh_last_poll = 0.0
2848# Per-peer set of alert keys already folded into the incident engine. Peers
2849# serve a rolling window, so every poll re-sends what we saw last cycle.
2850_mesh_alert_seen = {}
2851# Per-peer cached security findings (vulns/integrity/watchtower/incidents),
2852# refreshed each poll and rendered as the fleet findings view.
2853_mesh_peer_findings = {}
2854# Live health of the poll LOOP itself, surfaced in the Mesh tab so a stalled or
2855# crashing poller is visible in the browser instead of only in the logs. This is
2856# the difference between "sees peers but never polls" (a loop problem) and "polls
2857# but the peer refuses" (a peer problem) — the UI could not tell them apart.
2858_mesh_poll_state = {'loop_started': False, 'last_ok_at': 0.0,
2859 'last_error': '', 'last_summary': ''}
2860
2861# Tailscale-install-from-the-UI state. Installing pulls a vendor script and runs
2862# apt, so it takes a minute or two — run it in the background and let the tab
2863# poll, exactly like the sensing-backend install.
2864MESH_INSTALL_SCRIPT = os.path.join(shared_data.currentdir, 'scripts', 'setup_mesh.sh')
2865MESH_INSTALL_LOG = os.path.join(shared_data.currentdir, 'data', 'mesh_install.log')
2866_mesh_install_lock = threading.Lock()
2867_mesh_installing = False
2868
2869
2870def _run_mesh_install():
2871 """Install the Tailscale client in the background, logging to MESH_INSTALL_LOG.

Callers

nothing calls this directly

Calls 3

_stop_serviceFunction · 0.85
infoMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected