← Back to issue list

providers: refactor to better support multiple providers (CRAFT-362)

View original Github issue

Metadata

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

Current evaluation

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.

Resolution: closed resolved

Reason: The PR itself was merged into main as commit 93982f90 (merge commit 7a1f50fc) with 2 approving reviews and no failing checks. A follow-up commit ee66966e renamed providers._helpers to _logs, satisfying the author's single review comment.

Evaluated by: mr-cal-bot

No scores available.

Issue body

With the upcoming introduction of Multipass, the providers module would grow significantly in complexity. Convert providers module into a package, splitting out functionality into well scoped modules. Introduce a common Provider class to be the general interface for any Charmcraft-supported providers, and refactor the LXD-specifics into a new subclass LXDProvider. Add interface get_provider() for users of providers to get the correct provider (only returns an instance of LXDProvider at this time). There should be no change in behaviors with this commit, the large diff is to accompany the shuffling of the whole module into a new package, folding this functionality into the new provider classes, and updating the test mocks. Signed-off-by: Chris Patterson <chris.patterson@canonical.com>

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved 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.
stealth/space-bunny-alpha — closed resolved Merged Charmcraft PR #484, reorganizing providers into a package with a common Provider interface, LXDProvider subclass, and get_provider() while preserving behavior.
qwen/qwen3.6-35b-a3b — — 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.
qwen3.6-35b-a3b-mtp-q6 — — Merged a refactor converting the providers module into a package with a base Provider class and LXDProvider subclass to support future providers. No behavioral changes were made, mocks updated, and _helpers renamed to _logs.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/charmcraft#485 (confidence 55%)

    Likely the follow-up commit ee66966e 'providers: rename _helpers module to _logs' addressing the review comment

Related issues

Issue Project State Summary Similarity
#92 providers: refactor get_provider() rockcraft merged Merged PR #92 as commit 5bcc1c80, refactoring get_provider() and moving it from _get_provider.py to providers.py for CRAFT-1375.
83%
#899 providers: use new craft-providers interface charmcraft merged Merged PR #899 (merge commit 538aec31, implementation 5e5acb7c): removed Charmcraft's own Provider/LXDProvider/MultipassProvider classes in favour of craft-providers', and moved charmcraft/providers/providers.py to charmcraft/providers.py. Resolves CRAFT-1279.
80%
#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.
79%
#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).
76%
#120 providers: use new craft-providers interface rockcraft merged Merged as 3f887b70: replaced Rockcraft's local provider classes with craft-providers and moved providers.py.
75%
#3660 providers: integrate craft-providers support snapcraft merged PR #3660 by cmatsuoka integrated craft-providers into Snapcraft, running lifecycle commands in LXD/Multipass instances. Merged into the 7.0 line via merge commit 7c2ac0027 (squash commit 8a06cdbbd).
74%
#3940 providers: move `get_provider()` to providers.py snapcraft merged Merged PR #3940 by mr-cal moved get_provider() into snapcraft/providers.py (squash commit 2acdd89b6), a CRAFT-1409 refactor mirroring canonical/rockcraft#92, part of a series of provider/lifecycle function moves.
74%
#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.
74%
#898 providers: move `get_provider()` to providers.py charmcraft merged Merged charmcraft#898, moving get_provider() into providers.py for CRAFT-1410 after prerequisite charmcraft#896 landed.
72%
#4437 build(deps): bump craft-providers to 1.19.2 snapcraft merged Merged as commit 7f03ece0b, updating craft-providers to 1.19.2 and its base-v3 LXD compatibility fix; equivalent update #4438 landed as 3ddaf758b.
72%