From 745c2b00ae474696e742d1474f1b9f907e2c277d Mon Sep 17 00:00:00 2001 From: Jan Dubois Date: Tue, 9 Sep 2025 19:58:40 -0700 Subject: [PATCH] Properly embed base templates in `limactl prune` No code should process a Lima template where template locators have not been resolved. Signed-off-by: Jan Dubois --- cmd/limactl/prune.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/limactl/prune.go b/cmd/limactl/prune.go index 6fb9aa2a3db..bfaef611dff 100644 --- a/cmd/limactl/prune.go +++ b/cmd/limactl/prune.go @@ -13,6 +13,7 @@ import ( "github.com/lima-vm/lima/v2/pkg/downloader" "github.com/lima-vm/lima/v2/pkg/driverutil" + "github.com/lima-vm/lima/v2/pkg/limatmpl" "github.com/lima-vm/lima/v2/pkg/limatype" "github.com/lima-vm/lima/v2/pkg/limayaml" "github.com/lima-vm/lima/v2/pkg/store" @@ -92,11 +93,14 @@ func knownLocations(ctx context.Context) (map[string]limatype.File, error) { return nil, err } for _, t := range templates { - b, err := templatestore.Read(t.Name) + tmpl, err := limatmpl.Read(ctx, "", t.Location) if err != nil { return nil, err } - y, err := limayaml.Load(ctx, b, t.Name) + if err := tmpl.Embed(ctx, true, true); err != nil { + return nil, err + } + y, err := limayaml.Load(ctx, tmpl.Bytes, tmpl.Name) if err != nil { return nil, err }