eebus: fix duplicate template names (#16484)

This commit is contained in:
Michael Geers 2024-10-03 18:46:47 +02:00 • committed by GitHub
parent 921837c3e7
commit 6395307a53
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 7 additions and 3 deletions

View file

@ -1,4 +1,4 @@
template: eebus
template: elli-2
products:
- brand: Elli
description:

View file

@ -1,4 +1,4 @@
template: eebus
template: ghost
products:
- brand: eSystems
description:

View file

@ -1,4 +1,4 @@
template: eebus
template: porsche-wallbox
products:
- brand: Porsche
description:

View file

@ -84,6 +84,10 @@ func load(class Class) (res []Template) {
return fmt.Errorf("processing template '%s' failed: %w", filepath, err)
}
if slices.ContainsFunc(res, func(t Template) bool { return t.Template == tmpl.Template }) {
return fmt.Errorf("duplicate template name '%s' found in file '%s'", tmpl.Template, filepath)
}
res = append(res, tmpl)
return nil