fix: limactl create <image URL> honors --name flag#4628
Merged
jandubois merged 1 commit intolima-vm:masterfrom Feb 24, 2026
Merged
fix: limactl create <image URL> honors --name flag#4628jandubois merged 1 commit intolima-vm:masterfrom
limactl create <image URL> honors --name flag#4628jandubois merged 1 commit intolima-vm:masterfrom
Conversation
28151cc to
1f5af59
Compare
There was a problem hiding this comment.
Pull request overview
Fixes limactl create <image URL> so an explicit --name is not overwritten by the image-URL-derived default name, aligning the image URL path with the other limatmpl.Read() locator handlers.
Changes:
- Guard
tmpl.Nameassignment inimageTemplate()so it only derives a name when none was provided. - Add a regression test ensuring
Read()respects an explicit name for image URLs and still derives a default when name is empty.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/limatmpl/locator.go | Prevents image URL handling from overwriting a caller-provided instance name. |
| pkg/limatmpl/locator_test.go | Adds coverage for both explicit-name override and default name derivation for image URLs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
`imageTemplate()` unconditionally overwrote `tmpl.Name` with the name derived from the image URL, ignoring the `--name` flag passed via CLI. Every other code path in `Read()` already guards the name assignment with `if tmpl.Name == ""`. Apply the same guard in `imageTemplate()`. Fixes lima-vm#4626 Signed-off-by: Harry-kp <chaudharyharshit9@gmail.com>
1f5af59 to
8ee52e3
Compare
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.
Summary
limactl create <HTTPS URL to an image>ignores--name#4626imageTemplate()inpkg/limatmpl/locator.gounconditionally overwrotetmpl.Namewith the name derived from the image URL, ignoring the--nameCLI flag. Every other code path inRead()already guards the assignment withif tmpl.Name == ""— this PR applies the same guard toimageTemplate().Reproduction
Before: instance created as
freebsd-15.0-release-arm64-basic-zfs, ignoring--name freebsdAfter: instance created as
freebsdChanges
pkg/limatmpl/locator.go: Guardtmpl.Nameassignment inimageTemplate()withif tmpl.Name == ""pkg/limatmpl/locator_test.go: AddTestReadImageURLRespectsNamecovering both the--nameoverride and the default name derivation pathsTest plan
go test ./pkg/limatmpl/ -run TestReadImageURLRespectsName— passesTestInstNameFromImageURLtests — still pass