← Back to issue list

providers: gracefully handle when LXD not installed (CRAFT-329)

View original Github issue

Metadata

Project
charmcraft
Number
#419
Type
pull request
State
merged
Author
cjp256
Labels
—
Created
Updated
Closed

Current evaluation

Merged #419 to handle missing LXD: builds now require the provider, while cleanup safely skips container operations when LXD is unavailable.

Resolution: closed resolved

Reason: PR charmcraft#419 was merged in commit e3b876fd. Its implementation commit 79585246 added provider availability checks and updated build and cleanup behavior for missing LXD.

Evaluated by: mr-cal-bot

No scores available.

Issue body

When building, ensure LXD is installed if going to use a managed environment. When cleaning, check if LXD is installed before attempting to clean project containers. Add two interfaces in providers to support this: - ensure_provider_is_available() to raise error if not available (for cases like build where the provider may be required). - is_provider_available() to check and return bool (for cases like cleaning where the provider does not need to be available). Future work can extend ensure_provider_is_available() to assist the user in installation of the provider. Signed-off-by: Chris Patterson <chris.patterson@canonical.com>

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged #419 to handle missing LXD: builds now require the provider, while cleanup safely skips container operations when LXD is unavailable.
stealth/space-bunny-alpha — closed resolved Merged provider changes for CRAFT-329: builds enforce required LXD availability, while cleaning skips container cleanup when LXD is missing.
qwen/qwen3.6-35b-a3b — — Merged implementation for graceful LXD installation handling during build and clean operations. Introduces ensure_provider_is_available() and is_provider_available() interfaces to verify provider status before execution. Approved and passed CI.
qwen3.6-35b-a3b-mtp-q6 — — Merged changes introduce ensure_provider_is_available() and is_provider_available() interfaces to gracefully handle missing LXD during build and clean operations, preventing errors when the provider is absent.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#341 lxd: race condition when running multiple instances of craft-providers craft-providers closed Fixed by merged PR #357, which rechecks LXC project existence after creation fails, preventing concurrent project-creation races (CRAFT-1849).
74%
#424 providers: prompt user to install LXD if not installed (CRAFT-335) charmcraft merged Merged PR #424 added an interactive prompt to install missing LXD while skipping non-TTY sessions; implementation landed in commit accb19ad.
72%
#504 providers: improve error handling (CRAFT-472) charmcraft merged Merged PR #504 improved LXD and Multipass provider error handling, chained exceptions, and added tests for CRAFT-472.
72%
#9 providers: add build provider support (CRAFT-28) rockcraft merged Merged build-provider support via commit be6dec45, integrating craft-providers to run builds on LXD. User messages and provider log retrieval were deferred to follow-up work.
72%
#925 providers: set lxd project to 'charmcraft' charmcraft merged Merged PR #925 in d82b9bb8, fixing the LXD provider regression by using the charmcraft project instead of default.
71%
#2509 build providers: initial support for LXD snapcraft merged Merged PR #2509 (commit 067024732) adding initial LXD build-provider support: `snapcraft --use-lxd` runs all lifecycle steps and clean inside an LXD container. Released via beta/lxd channel; LP bug #1805221 closed.
71%
#2647 build providers: catch LXD socket error snapcraft merged Merged PR #2647 as commit d1902b8cb, adding error handling for LXD socket failures in build providers.
71%
#3115 build providers: ignore missing LXD instance when cleaning project snapcraft merged Merged PR #3115 (commit 8ce59011a) makes project cleanup ignore missing LXD instances deleted manually.
70%