feat(mutator): live teardown for apply_remove_decky

Captures the decky's name and services list before delete_topology_decky
runs (the helper needs both as compose targets even though the DB row
is gone), then calls _materialise_decky_remove which stops + rm -f's
the base + per-service containers via 'docker compose stop / rm -f'.

Re-renders the per-topology compose AFTER the stop/rm so a future
'compose up -d' on the file doesn't try to bring the decky back.
This commit is contained in:
2026-04-29 00:14:44 -04:00
parent 8c06190e69
commit eed55619cb

View File

@@ -758,7 +758,15 @@ async def apply_remove_decky(
decky = _decky_by_name(hydrated, payload["decky"]) decky = _decky_by_name(hydrated, payload["decky"])
if decky is None: if decky is None:
raise MutationError(f"decky {payload['decky']!r} not found") raise MutationError(f"decky {payload['decky']!r} not found")
decky_name = decky["decky_config"]["name"]
services_list = list(decky.get("services") or [])
await repo.delete_topology_decky(decky["uuid"]) await repo.delete_topology_decky(decky["uuid"])
# Live materialisation: stop + rm -f the decky's containers. We
# capture decky_name + services BEFORE the delete so the helper
# has the targets even though the row is gone.
await _materialise_decky_remove(
repo, topology_id, decky_name, services_list,
)
await _assert_valid_after(repo, topology_id) await _assert_valid_after(repo, topology_id)