Skip to content

Commit 400c9e9

Browse files
committed
Add hostArch, hostOS, and identityFile to limactl info
These fields are added in `limactl ls` to each instance, but they are global values and don't belong there. The LimaHome field already existed in `limactl info`. The field names start with lowercase to match the existing naming scheme. Signed-off-by: Jan Dubois <[email protected]>
1 parent 06ac5b9 commit 400c9e9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pkg/limainfo/limainfo.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@ import (
77
"context"
88
"errors"
99
"io/fs"
10+
"path/filepath"
11+
"runtime"
1012

1113
"github.com/sirupsen/logrus"
1214

1315
"github.com/lima-vm/lima/v2/pkg/envutil"
1416
"github.com/lima-vm/lima/v2/pkg/limatype"
1517
"github.com/lima-vm/lima/v2/pkg/limatype/dirnames"
18+
"github.com/lima-vm/lima/v2/pkg/limatype/filenames"
1619
"github.com/lima-vm/lima/v2/pkg/limayaml"
1720
"github.com/lima-vm/lima/v2/pkg/registry"
1821
"github.com/lima-vm/lima/v2/pkg/templatestore"
@@ -29,6 +32,9 @@ type LimaInfo struct {
2932
VMTypesEx map[string]DriverExt `json:"vmTypesEx"` // since Lima v2.0.0
3033
GuestAgents map[limatype.Arch]GuestAgent `json:"guestAgents"` // since Lima v1.1.0
3134
ShellEnvBlock []string `json:"shellEnvBlock"`
35+
HostOS string `json:"hostOS"` // since Lima v2.0.0
36+
HostArch string `json:"hostArch"` // since Lima v2.0.0
37+
IdentityFile string `json:"identityFile"` // since Lima v2.0.0
3238
}
3339

3440
type DriverExt struct {
@@ -72,6 +78,8 @@ func New(ctx context.Context) (*LimaInfo, error) {
7278
VMTypesEx: vmTypesEx,
7379
GuestAgents: make(map[limatype.Arch]GuestAgent),
7480
ShellEnvBlock: envutil.GetDefaultBlockList(),
81+
HostOS: runtime.GOOS,
82+
HostArch: limatype.NewArch(runtime.GOARCH),
7583
}
7684
info.Templates, err = templatestore.Templates()
7785
if err != nil {
@@ -81,6 +89,11 @@ func New(ctx context.Context) (*LimaInfo, error) {
8189
if err != nil {
8290
return nil, err
8391
}
92+
configDir, err := dirnames.LimaConfigDir()
93+
if err != nil {
94+
return nil, err
95+
}
96+
info.IdentityFile = filepath.Join(configDir, filenames.UserPrivateKey)
8497
for _, arch := range limatype.ArchTypes {
8598
bin, err := usrlocalsharelima.GuestAgentBinary(limatype.LINUX, arch)
8699
if err != nil {

0 commit comments

Comments
 (0)