← Back to issue list

lxd: Only remove container if one exists

View original Github issue

Metadata

Project
snapcraft
Number
#1403
Type
pull request
State
merged
Author
kalikiana
Labels
—
Created
Updated
Closed

Current evaluation

Merged PR #1403, adding an LXD existence check so failed container creation no longer triggers a second exception while stopping or removing a nonexistent container.

Resolution: closed resolved

Reason: PR #1403 was approved and merged. Its cleanup checks whether the LXD container exists before attempting to stop or remove it, avoiding the duplicate exception.

Evaluated by: mr-cal-bot

No scores available.

Issue body

If creating a LXD container fails snapcraft always produces two exceptions because it will attempt to remove the non-existing container - this adds a check to avoid that. Not sure about unit tests... we'd need to know that no exception was raised for 'lxc stop'.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged PR #1403, adding an LXD existence check so failed container creation no longer triggers a second exception while stopping or removing a nonexistent container.
stealth/space-bunny-alpha — closed resolved Merged in snapcraft#1403, adding a container-existence check so failed LXD creation no longer triggers a second stop/remove exception.
stealth/space-bunny-alpha — closed resolved Merged snapcraft PR #1403 adds an LXD container-existence check, preventing failed creation cleanup from raising a second exception for stopping or removing a nonexistent container.
qwen/qwen3.6-35b-a3b — — Merged following two reviewer approvals and passing CI. The update resolves duplicate exceptions during failed LXD container creation by adding a conditional check before attempting container removal.
qwen3.6-35b-a3b-mtp-q6 — — Merged a fix preventing snapcraft from throwing duplicate exceptions when LXD container creation fails. The change adds a pre-removal existence check. Reviewer approved and suggested unit tests by patching the status method.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1624075 cleanbuild - Don't try to stop a non-existent container snapcraft (launchpad) closed Fixed by merged PR canonical/snapcraft#1403, adding an LXD existence check so cleanbuild no longer tries to stop or remove a container that was never created.
74%
#1762 lxd: delete container only if parts is empty snapcraft merged Merged PR #1762 (dbce9a058), changing LXD cleanup to delete a build container only after all parts are removed, preserving it for targeted cleans and making repeated cleans safe.
73%
#1434 lxd: clean with no parts should only delete snapcraft merged Merged #1434 in commit 33c7a6bc1, making argless LXD clean delete container resources without executing commands inside the container.
70%