Skip to content

Commit 745c2b0

Browse files
committed
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 <jan.dubois@suse.com>
1 parent 2105d57 commit 745c2b0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cmd/limactl/prune.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313

1414
"github.com/lima-vm/lima/v2/pkg/downloader"
1515
"github.com/lima-vm/lima/v2/pkg/driverutil"
16+
"github.com/lima-vm/lima/v2/pkg/limatmpl"
1617
"github.com/lima-vm/lima/v2/pkg/limatype"
1718
"github.com/lima-vm/lima/v2/pkg/limayaml"
1819
"github.com/lima-vm/lima/v2/pkg/store"
@@ -92,11 +93,14 @@ func knownLocations(ctx context.Context) (map[string]limatype.File, error) {
9293
return nil, err
9394
}
9495
for _, t := range templates {
95-
b, err := templatestore.Read(t.Name)
96+
tmpl, err := limatmpl.Read(ctx, "", t.Location)
9697
if err != nil {
9798
return nil, err
9899
}
99-
y, err := limayaml.Load(ctx, b, t.Name)
100+
if err := tmpl.Embed(ctx, true, true); err != nil {
101+
return nil, err
102+
}
103+
y, err := limayaml.Load(ctx, tmpl.Bytes, tmpl.Name)
100104
if err != nil {
101105
return nil, err
102106
}

0 commit comments

Comments
 (0)