providers: add Provider, LXDProvider, and MultipassProvider classes
Metadata
Current evaluation
Merged Provider, LXDProvider, and MultipassProvider classes via commit fa5a5e7, adding simplified provider error handling and integration tests.
Resolution: closed resolved
Reason: PR #163 was approved and merged as commit fa5a5e7, introducing all three provider classes and their integration tests.
Evaluated by: mr-cal-bot
No scores available.
Issue body
- [X] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
-----
Add Provider, LXDProvider, and MultipassProvider classes.
These classes are near-duplicates of the classes in rockcraft (links for [provider](https://github.com/canonical/rockcraft/blob/4cfd6c8bac0b112127d420c8a3a1c6b0f3033ab5/rockcraft/providers/_provider.py), [lxd](https://github.com/canonical/rockcraft/blob/4cfd6c8bac0b112127d420c8a3a1c6b0f3033ab5/rockcraft/providers/_lxd.py), and [multipass](https://github.com/canonical/rockcraft/blob/4cfd6c8bac0b112127d420c8a3a1c6b0f3033ab5/rockcraft/providers/_multipass.py))
There are a few minor differences:
1. changes to `import` statements and `__init__.py` files
2. Simplified error handling in methods `ensure_provider_is_available()` and `launched_environment()`
- For example, there is no need to catch a `LXDError` and raise a `ProviderError`, since `LXDError` is a child of a `ProviderError`. This simplification is completely compatible with error handling inside the *craft tools.
3. New integration tests for the provider classes
I've tested this with rockcraft and it works great!
(CRAFT-1360, CRAFT-1361, CRAFT-1362)
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged Provider, LXDProvider, and MultipassProvider classes via commit fa5a5e7, adding simplified provider error handling and integration tests. | |
| qwen/qwen3.6-35b-a3b | — | closed resolved | Added Provider, LXDProvider, and MultipassProvider classes adapted from rockcraft, featuring simplified error handling and new integration tests. Merged. |
Update history
| Date | Change |
|---|---|
| created |
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #90 Extract common patterns from applications | craft-providers | closed | Added higher-level Provider, LXDProvider, and MultipassProvider classes to reduce boilerplate; merged in PR #163 via commit fa5a5e7. | |
| #2678 cli: introduce --provider | snapcraft | merged | Merged PR #2678 as commit b1bee8d99, introducing a unified --provider option for host, LXD, and Multipass and consolidating provider-specific build and clean flags. | |
| #238 provider: add `allow_unstable` to Provider base class | craft-providers | merged | Merged as commit 564b789: added `allow_unstable` parameter to Provider.launched_environment() base class and Multipass, promoting LXDProvider's option; Multipass uses it in a follow-up. Documented in changelog. | |
| #3943 providers: use new craft-providers interface | snapcraft | merged | Merged into snapcraft main as commit 2980d145c: removed in-tree Provider/LXDProvider/MultipassProvider classes in favour of craft-providers, and moved snapcraft/providers/providers.py to snapcraft/providers.py (+65/-1173). | |
| #893 Add a `prune` method for Providers | craft-providers | closed | Provider pruning was added in merged PR #925 (commit 9836260), with LXD and Multipass implementations plus unit and integration tests. | |
| #925 feat: add prune method | craft-providers | merged | Merged PR #925 as commit 9836260, adding Provider.prune with LXD and Multipass implementations and tests; it closes issue #893. | |
| #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. | |
| #484 providers: refactor to better support multiple providers (CRAFT-362) | charmcraft | merged | Merged PR #484 (commit 93982f90, merge 7a1f50fc) by cjp256 converted providers module into a package for CRAFT-362: added common Provider class, LXDProvider subclass and get_provider(); follow-ups moved get_provider() to providers.py and renamed _helpers to _logs. |