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

Suggested action:

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
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.
qwen3.6-35b-a3b-mtp-q6 Merged changes adding ensure_provider_is_available() and is_provider_available() interfaces to gracefully handle missing LXD during build and clean operations, resolving CRAFT-329.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#9 providers: add build provider support (CRAFT-28) rockcraft merged Merged integration of rockcraft with craft-providers to run build providers on LXD instances. The change ports Charmcraft glue code, hardwires execution to LXD, and defers user messages and log retrieval to follow-up PRs. Approved and passed CI.
73%
#504 providers: improve error handling (CRAFT-472) charmcraft merged Improved error handling for provider-generated exceptions by adding try/except blocks for LXD and Multipass, chaining exceptions, and adding test coverage. Merged after approval and passing CI checks.
72%
#424 providers: prompt user to install LXD if not installed (CRAFT-335) charmcraft merged Merged after two approvals and passing CI. Adds logic to prompt users to install LXD when missing, skipping non-interactive TTYs. Resolves CRAFT-335 with 88 additions and 24 deletions across two files.
71%
#484 providers: refactor to better support multiple providers (CRAFT-362) charmcraft merged Merged following two approvals and passing CI. Refactored the providers module into a package introducing a common Provider interface and LXDProvider subclass to accommodate future providers like Multipass. No behavioral changes. Minor naming adjustments applied during review.
71%
#2509 build providers: initial support for LXD snapcraft merged Merged initial LXD build provider support for snapcraft, enabling the --use-lxd flag for lifecycle steps and cleaning. Passes CI. Reviewers noted minor dependency and container setup edge cases, which were clarified or deferred.
70%