fix vlan template and data

This commit is contained in:
Samuel Lorch 2023-04-08 14:51:03 +02:00
parent d6c58b7d21
commit fc49a2479e
2 changed files with 5 additions and 5 deletions

View file

@ -145,9 +145,13 @@ func GenerateNetworkdConfiguration(conf definitions.Config) ([]NetworkdConfigFil
slog.Info("Vlans on interface", "interface", name, "count", len(vlans))
if len(vlans) != 0 {
parentName := name
if inter.Type == definitions.Hardware {
parentName = *inter.HardwareDevice
}
buf := new(bytes.Buffer)
err := templates.ExecuteTemplate(buf, "vlan-assignments.network.tmpl", VlanAssignments{
Name: name,
Name: parentName,
Vlans: vlans,
})
if err != nil {

View file

@ -1,9 +1,5 @@
[Match]
{{- if eq .Type 0 }}
Name={{ .HardwareDevice }}
{{- else }}
Name={{ .Name }}
{{- end }}
[Network]
{{- range .Vlans }}