@@ -145,6 +145,8 @@ func Validate(y *LimaYAML, warn bool) error {
145
145
}
146
146
147
147
var mountErrs []error
148
+ excludedDirs := []string {"/tmp/lima" }
149
+
148
150
for i , f := range y .Mounts {
149
151
if ! filepath .IsAbs (f .Location ) && ! strings .HasPrefix (f .Location , "~" ) {
150
152
mountErrs = append (mountErrs , fmt .Errorf ("field `mounts[%d].location` must be an absolute path, got %q" , i , f .Location ))
@@ -154,15 +156,17 @@ func Validate(y *LimaYAML, warn bool) error {
154
156
if err != nil {
155
157
mountErrs = append (mountErrs , fmt .Errorf ("field `mounts[%d].location` refers to an unexpandable path: %q: %w" , i , f .Location , err ))
156
158
}
157
- st , err := os .Stat (loc )
158
- if err != nil {
159
- if errors .Is (err , os .ErrNotExist ) {
160
- mountErrs = append (mountErrs , fmt .Errorf ("field `mounts[%d].location` refers to non-existent path: %q: %w" , i , f .Location , err ))
161
- continue
159
+ if ! isContain (loc , excludedDirs ) {
160
+ st , err := os .Stat (loc )
161
+ if err != nil {
162
+ if errors .Is (err , os .ErrNotExist ) {
163
+ mountErrs = append (mountErrs , fmt .Errorf ("field `mounts[%d].location` refers to non-existent path: %q: %w" , i , f .Location , err ))
164
+ } else {
165
+ mountErrs = append (mountErrs , fmt .Errorf ("field `mounts[%d].location` refers to an inaccessible path: %q: %w" , i , f .Location , err ))
166
+ }
167
+ } else if ! st .IsDir () {
168
+ mountErrs = append (mountErrs , fmt .Errorf ("field `mounts[%d].location` refers to a non-directory path: %q: %w" , i , f .Location , err ))
162
169
}
163
- mountErrs = append (mountErrs , fmt .Errorf ("field `mounts[%d].location` refers to an inaccessible path: %q: %w" , i , f .Location , err ))
164
- } else if ! st .IsDir () {
165
- mountErrs = append (mountErrs , fmt .Errorf ("field `mounts[%d].location` refers to a non-directory path: %q: %w" , i , f .Location , err ))
166
170
}
167
171
168
172
switch * f .MountPoint {
@@ -601,3 +605,12 @@ func warnExperimental(y *LimaYAML) {
601
605
logrus .Warn ("`mountInotify` is experimental" )
602
606
}
603
607
}
608
+
609
+ func isContain (v string , slice []string ) bool {
610
+ for _ , s := range slice {
611
+ if s == v {
612
+ return true
613
+ }
614
+ }
615
+ return false
616
+ }
0 commit comments