Skip to content

Commit 6c7485b

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

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

examples/default.yaml

+1-1
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func GenerateISO9660(instDir, name string, y *limayaml.LimaYAML, udpDNSLocalPort
199199
if err != nil {
200200
return err
201201
}
202-
mountPoint, err := localpathutil.Expand(f.MountPoint)
202+
mountPoint, err := localpathutil.Expand(*f.MountPoint)
203203
if err != nil {
204204
return err
205205
}

pkg/hostagent/mount.go

+1-1
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

+3-3
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
601601
if mount.Writable != nil {
602602
mounts[i].Writable = mount.Writable
603603
}
604-
if mount.MountPoint != "" {
604+
if mount.MountPoint != nil {
605605
mounts[i].MountPoint = mount.MountPoint
606606
}
607607
} else {
@@ -644,8 +644,8 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
644644
mounts[i].NineP.Cache = ptr.Of(Default9pCacheForRO)
645645
}
646646
}
647-
if mount.MountPoint == "" {
648-
mounts[i].MountPoint = mount.Location
647+
if mount.MountPoint == nil {
648+
mounts[i].MountPoint = ptr.Of(mount.Location)
649649
}
650650
}
651651

pkg/limayaml/defaults_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ func TestFillDefault(t *testing.T) {
194194
}
195195

196196
expect.Mounts = y.Mounts
197-
expect.Mounts[0].MountPoint = expect.Mounts[0].Location
197+
expect.Mounts[0].MountPoint = ptr.Of(expect.Mounts[0].Location)
198198
expect.Mounts[0].Writable = ptr.Of(false)
199199
expect.Mounts[0].SSHFS.Cache = ptr.Of(true)
200200
expect.Mounts[0].SSHFS.FollowSymlinks = ptr.Of(false)
@@ -395,7 +395,7 @@ func TestFillDefault(t *testing.T) {
395395
expect = d
396396
// Also verify that archive arch is filled in
397397
expect.Containerd.Archives[0].Arch = *d.Arch
398-
expect.Mounts[0].MountPoint = expect.Mounts[0].Location
398+
expect.Mounts[0].MountPoint = ptr.Of(expect.Mounts[0].Location)
399399
expect.Mounts[0].SSHFS.Cache = ptr.Of(true)
400400
expect.Mounts[0].SSHFS.FollowSymlinks = ptr.Of(false)
401401
expect.Mounts[0].SSHFS.SFTPDriver = ptr.Of("")

pkg/limayaml/limayaml.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ type Disk struct {
107107

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

0 commit comments

Comments
 (0)