Extract shared resolve_snap helper from duplicate plugin implementations#324
Merged
smethnani merged 2 commits intowork/classic-snap-prepare-image-pluginfrom Apr 22, 2026
Merged
Conversation
4 tasks
Agent-Logs-Url: https://github.com/canonical/imagecraft/sessions/4615f0f5-ebf0-4d3b-86ea-03f5a729dd29 Co-authored-by: lengau <4305943+lengau@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] [WIP] Address feedback on snap prepare-image plugins PR
Extract shared Apr 21, 2026
resolve_snap helper from duplicate plugin implementations
smethnani
approved these changes
Apr 22, 2026
86190fa
into
work/classic-snap-prepare-image-plugin
2 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
_resolve_snapwas duplicated verbatim acrosssnap_preseed_plugin.pyanduc_prepare_plugin.py, creating a divergence risk for snap reference handling.Changes
imagecraft/plugins/_utils.py(new) — module-levelresolve_snap(snap: str) -> strfunction; strips whitespace and convertsname/channel→name=channelforsnap prepare-imagesnap_preseed_plugin.py/uc_prepare_plugin.py— remove_resolve_snapinstance methods; import and callresolve_snapfrom._utilstests/unit/plugins/test_utils.py(new) — parametrized tests forresolve_snapcovering plain names, whitespace, local.snappaths, and channel references