← 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 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.

Suggested action:

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
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
#1762 lxd: delete container only if parts is empty snapcraft merged Merged fix resolving bug 1734145 by updating LXD container cleanup logic to only delete containers when parts are empty. Approved by one reviewer, passed CI checks, and modified two files.
85%
#1434 lxd: clean with no parts should only delete snapcraft merged Merged. Updates snapcraft LXD handling so running clean without arguments only deletes container resources instead of executing commands inside them. Approved by one reviewer and merged.
77%
#2095 lxd: proper error classes for container errors snapcraft merged Merged after approval. Refactored LXD container errors into dedicated classes, relocated them to the LXD module, and fixed architecture retrieval error handling. Added corresponding unit tests. Resolves Launchpad bugs #1734233 and #1734235.
76%
#1488 lxd: always remove existing device for project folder snapcraft merged Merged as a follow-up to #1483, ensuring existing devices are always removed for the LXD project folder. Approved by two reviewers with zero unresolved comments. The change modifies three files, adds 64 lines, removes one, and passed all CI checks.
75%
#1627 lxd: split container classes into different files snapcraft merged Merged refactoring splitting LXD container classes from lxd.py into separate modules. Improves organization, moves Cleanbuilder methods, de-duplicates env vars, and fixes mocking imports. No functional changes. Approved by two reviewers and passed CI.
74%
#1644 lxd: fix the push in container builds snapcraft merged Merged pull request fixing LXD container push builds. Approved by one reviewer, the change refactored test cases for better coverage and updated build logic. Review comments highlighted the need for Travis integration and broader testing beyond unit tests.
73%
#1742 lxd: always remove tmp_dir after execution snapcraft merged Merged fix ensuring the temporary directory is always removed after LXD container builds, preventing disk space waste on errors. Approved and passed CI.
73%
#1516 lxd: LXD not installed when using remote snapcraft merged Merged fix for a bug where lxc installation was not correctly verified when using a LXD remote. Also corrected incomplete test scenario usage. Approved by two reviewers, modified two files.
72%
#1978 ci: switch to stable lxd and unconfined containers snapcraft merged Merged CI configuration update switching to stable LXD and unconfined containers. Approved by two reviewers with a two-file, five-line change.
72%
#1677 ci: don't install lxd craft-parts merged Merged a CI configuration update removing the unused LXD installation. Approved by three reviewers, the change was integrated despite unrelated test failures stemming from a Launchpad issue.
72%