Skip to content

Commit ecd8542

Browse files
authored
Merge pull request #2317 from AkihiroSuda/fix-2313
Fix "FATA[0002] networks.yaml field `paths.varRun` error: path "." is not an absolute path"
2 parents 8355d5e + 65faa5f commit ecd8542

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pkg/networks/config.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,16 @@ func loadCache() {
132132
if cache.err != nil {
133133
return
134134
}
135-
cache.err = yaml.UnmarshalWithOptions(b, &cache.config, yaml.Strict())
135+
cache.err = yaml.UnmarshalWithOptions(b, &cache.config, yaml.DisallowDuplicateKey())
136136
if cache.err != nil {
137137
cache.err = fmt.Errorf("cannot parse %q: %w", configFile, cache.err)
138+
return
139+
}
140+
var strictConfig YAML
141+
if strictErr := yaml.UnmarshalWithOptions(b, &strictConfig, yaml.Strict()); strictErr != nil {
142+
// Allow non-existing YAML fields, as a config created with Lima < v0.22 contains `vdeSwitch` and `vdeVMNet`.
143+
// These fields were removed in Lima v0.22.
144+
logrus.WithError(strictErr).Warn("Non-strict YAML is deprecated and will be unsupported in a future version of Lima: " + configFile)
138145
}
139146
cache.config, cache.err = fillDefaults(cache.config)
140147
if cache.err != nil {

0 commit comments

Comments
 (0)