Skip to content

Install/uninstall: only remove the containers and images lager owns#146

Merged
danielrmerskine merged 1 commit into
mainfrom
de/deploy-scoped-cleanup
Jul 23, 2026
Merged

Install/uninstall: only remove the containers and images lager owns#146
danielrmerskine merged 1 commit into
mainfrom
de/deploy-scoped-cleanup

Conversation

@danielrmerskine

Copy link
Copy Markdown
Collaborator

Summary

lager install (via setup_and_deploy_box.sh) stopped and force-removed every container on the box (docker rm -f $(docker ps -aq)) and pruned every unused image (docker image prune -af); lager uninstall's image cleanup ran the same blanket prune. On a box that also runs third-party containers — a management agent, a user's own databases — this destroys infrastructure the tooling cannot restore. The uninstall prune has previously deleted a user's own images in the field; the box-lifecycle CI's first supervised reinstall (#144) reproduced the class directly by taking down the box's own management agent mid-run.

Changes

  • cli/deployment/scripts/setup_and_deploy_box.sh: container cleanup is scoped to what the deployment owns — lager, pigpio, and the legacy controller — instead of everything on the machine; the image prune drops -a (dangling layers only).
  • cli/commands/utility/uninstall.py: the blanket docker image prune -af becomes docker rmi -f lager + a dangling-only prune, and the "will be REMOVED" summary now states the true scope.

The principle in both: never remove a container or image this tooling did not create. No knowledge of what else runs on the box is needed or assumed.

Testing

  • bash -n on the modified deploy script.
  • Full root + cli unit suites green in a clean python:3.11 container (717 tests; test_uninstall_spec pins the removal-step spec and passes unchanged).
  • On-box validation rides the box-lifecycle workflow (CI: full box-lifecycle regression on the bench; sign the runner in to the box access gateway #144), whose reinstall phase executes this exact path against a box running a third-party agent — its post-install health checks are the end-to-end proof.

Checklist

  • Code follows the project's style guidelines
  • Copyright headers are present on new files — n/a (no new files)
  • CHANGELOG.md updated
  • Documentation updated (if applicable) — n/a

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

The deploy script stopped and force-removed EVERY container on the box
(docker rm -f $(docker ps -aq)) and pruned every unused image
(docker image prune -af); uninstall's image cleanup ran the same prune.
On a box that also runs third-party containers — a management agent, a
user's own services — this destroyed infrastructure the tooling cannot
restore, and the image prune has previously deleted a user's own images.

Scope the cleanup to what lager creates:

- setup_and_deploy_box.sh: stop/remove only lager, pigpio, and the
  legacy controller container; image prune drops -a (dangling only).
- uninstall.py: replace the blanket image prune with `docker rmi lager`
  plus a dangling-only prune, and correct the removal summary text.

Found by the box-lifecycle CI's first supervised reinstall, which took
down the box's own management agent mid-run.
@danielrmerskine
danielrmerskine force-pushed the de/deploy-scoped-cleanup branch from 3c76b33 to 34cb1ed Compare July 23, 2026 20:37
@danielrmerskine
danielrmerskine merged commit 71987f0 into main Jul 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant