feat(backend): add teardown() to the contract; backend teardown
Add an abstract teardown() classmethod to BottleBackend — the inverse of setup(), surfaced as `./cli.py backend teardown [--backend=NAME]` (uninstall). Symmetric with setup: it prints the privileged commands / declarative config change to remove the host prerequisites. - firecracker: NixOS-aware — disable the flake module (or drop the import) and rebuild, or `firecracker-netpool.sh down` imperatively. - docker / macos-container: nothing to undo (no privileged host state); print a short note. Not called by the launch path or the test suite. Extends test_cli_backend for the new dispatch. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WBMWTEtQdJ4W5UrWuLHCck
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
"""`backend` CLI command — generic host setup/status across backends.
|
||||
|
||||
`./cli.py backend setup [--backend=NAME]` provisions (or points at how
|
||||
`./cli.py backend setup [--backend=NAME]` provisions (or points at how
|
||||
to provision) the chosen backend's one-time host prerequisites.
|
||||
`./cli.py backend status [--backend=NAME]` reports readiness.
|
||||
`./cli.py backend status [--backend=NAME]` reports readiness.
|
||||
`./cli.py backend teardown [--backend=NAME]` undoes setup (uninstall).
|
||||
|
||||
Both dispatch to the backend's `setup()` / `status()` classmethods, so
|
||||
there are no backend-specific commands — swapping backends is just a
|
||||
different `--backend` (or `$BOT_BOTTLE_BACKEND`, or the host default).
|
||||
All dispatch to the backend's `setup()` / `status()` / `teardown()`
|
||||
classmethods, so there are no backend-specific commands — swapping
|
||||
backends is just a different `--backend` (or `$BOT_BOTTLE_BACKEND`, or
|
||||
the host default).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -24,8 +26,9 @@ def cmd_backend(args: list[str]) -> int:
|
||||
)
|
||||
parser.add_argument(
|
||||
"action",
|
||||
choices=("setup", "status"),
|
||||
help="setup: provision/print host prerequisites; status: report readiness",
|
||||
choices=("setup", "status", "teardown"),
|
||||
help="setup: provision/print host prerequisites; status: report "
|
||||
"readiness; teardown: undo setup (uninstall)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--backend",
|
||||
@@ -38,4 +41,6 @@ def cmd_backend(args: list[str]) -> int:
|
||||
backend = get_bottle_backend(ns.backend)
|
||||
if ns.action == "setup":
|
||||
return backend.setup()
|
||||
if ns.action == "teardown":
|
||||
return backend.teardown()
|
||||
return backend.status()
|
||||
|
||||
Reference in New Issue
Block a user