Skip to content

Commit 1ed8206

Browse files
committed
Change mount mountPoint to string pointer
Signed-off-by: Anders F Björklund <[email protected]>
1 parent 7fd4d0b commit 1ed8206

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

examples/default.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ mounts:
5656
- location: "~"
5757
# Configure the mountPoint inside the guest.
5858
# 🟢 Builtin default: value of location
59-
mountPoint: ""
59+
mountPoint: null
6060
# CAUTION: `writable` SHOULD be false for the home directory.
6161
# Setting `writable` to true is possible, but untested and dangerous.
6262
# 🟢 Builtin default: false

pkg/cidata/cidata.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func GenerateISO9660(instDir, name string, y *limayaml.LimaYAML, udpDNSLocalPort
200200
if err != nil {
201201
return err
202202
}
203-
mountPoint, err := localpathutil.Expand(f.MountPoint)
203+
mountPoint, err := localpathutil.Expand(*f.MountPoint)
204204
if err != nil {
205205
return err
206206
}

pkg/hostagent/mount.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func (a *HostAgent) setupMount(m limayaml.Mount) (*mount, error) {
3737
return nil, err
3838
}
3939

40-
mountPoint, err := localpathutil.Expand(m.MountPoint)
40+
mountPoint, err := localpathutil.Expand(*m.MountPoint)
4141
if err != nil {
4242
return nil, err
4343
}

pkg/limayaml/defaults.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
608608
if mount.Writable != nil {
609609
mounts[i].Writable = mount.Writable
610610
}
611-
if mount.MountPoint != "" {
611+
if mount.MountPoint != nil {
612612
mounts[i].MountPoint = mount.MountPoint
613613
}
614614
} else {
@@ -651,8 +651,8 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
651651
mounts[i].NineP.Cache = ptr.Of(Default9pCacheForRO)
652652
}
653653
}
654-
if mount.MountPoint == "" {
655-
mounts[i].MountPoint = mount.Location
654+
if mount.MountPoint == nil {
655+
mounts[i].MountPoint = ptr.Of(mount.Location)
656656
}
657657
}
658658

pkg/limayaml/defaults_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ func TestFillDefault(t *testing.T) {
202202
}
203203

204204
expect.Mounts = y.Mounts
205-
expect.Mounts[0].MountPoint = expect.Mounts[0].Location
205+
expect.Mounts[0].MountPoint = ptr.Of(expect.Mounts[0].Location)
206206
expect.Mounts[0].Writable = ptr.Of(false)
207207
expect.Mounts[0].SSHFS.Cache = ptr.Of(true)
208208
expect.Mounts[0].SSHFS.FollowSymlinks = ptr.Of(false)
@@ -411,7 +411,7 @@ func TestFillDefault(t *testing.T) {
411411
expect = d
412412
// Also verify that archive arch is filled in
413413
expect.Containerd.Archives[0].Arch = *d.Arch
414-
expect.Mounts[0].MountPoint = expect.Mounts[0].Location
414+
expect.Mounts[0].MountPoint = ptr.Of(expect.Mounts[0].Location)
415415
expect.Mounts[0].SSHFS.Cache = ptr.Of(true)
416416
expect.Mounts[0].SSHFS.FollowSymlinks = ptr.Of(false)
417417
expect.Mounts[0].SSHFS.SFTPDriver = ptr.Of("")

pkg/limayaml/limayaml.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ type Disk struct {
108108

109109
type Mount struct {
110110
Location string `yaml:"location" json:"location"` // REQUIRED
111-
MountPoint string `yaml:"mountPoint,omitempty" json:"mountPoint,omitempty"`
111+
MountPoint *string `yaml:"mountPoint,omitempty" json:"mountPoint,omitempty" jsonschema:"nullable"`
112112
Writable *bool `yaml:"writable,omitempty" json:"writable,omitempty" jsonschema:"nullable"`
113113
SSHFS SSHFS `yaml:"sshfs,omitempty" json:"sshfs,omitempty"`
114114
NineP NineP `yaml:"9p,omitempty" json:"9p,omitempty"`

0 commit comments

Comments
 (0)