Fix Templater condition issue

* for some reason the one liner with multiple conditions is not
  working and due to which the generation of ethernet_mac_address
  is completely ignored

Change-Id: I642fc744c039cafbbd9cea48f861931fb67948c1
This commit is contained in:
Siraj Yasin 2021-09-29 21:07:07 +00:00
parent 23ccec608c
commit 8b9f1b4fd0
2 changed files with 6 additions and 2 deletions

View File

@ -36,7 +36,9 @@ template: |
metadata: metadata:
name: {{ .name }} name: {{ .name }}
spec: spec:
{{- if and (.macAddresses) (.macAddresses.oam) }} {{- if .macAddresses }}
{{- if .macAddresses.oam }}
bootMACAddress: {{ .macAddresses.oam }} bootMACAddress: {{ .macAddresses.oam }}
{{- end }} {{- end }}
{{- end }}
{{ end -}} {{ end -}}

View File

@ -92,10 +92,12 @@ template: |
{{- range $envAll.commonNetworking.links }} {{- range $envAll.commonNetworking.links }}
- -
{{ toYaml . | indent 6 }} {{ toYaml . | indent 6 }}
{{- if and ($host.macAddresses) (index $host.macAddresses .id) }} {{- if $host.macAddresses }}
{{- if index $host.macAddresses .id }}
ethernet_mac_address: {{ index $host.macAddresses .id }} ethernet_mac_address: {{ index $host.macAddresses .id }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }}
networks: networks:
{{- range $envAll.commonNetworking.networks }} {{- range $envAll.commonNetworking.networks }}
- -