Added m3-gen integrity checks

Without that check we may get firmware: null
that will be a mistake

Change-Id: Ib86a5ff7b54a6a280768832646f612568da93046
This commit is contained in:
Alexey Odinokov 2021-05-11 03:02:19 +00:00
parent 5dcc769243
commit 431043972c
2 changed files with 8 additions and 2 deletions

View File

@ -36,6 +36,12 @@ template: |
{{- $_ := set $host "hardwareProfile" "default" }}
{{- end }}
{{- $hardwareProfile := index $envAll.hardwareProfiles $host.hardwareProfile }}
{{- if not $hardwareProfile -}}
{{- fail (printf "can't find hardwareProfile %s" $host.hardwareProfile) -}}
{{- end -}}
{{- if not $hardwareProfile.firmware -}}
{{- fail (printf "hardwareProfile %s doesn't have firmware field" $host.hardwareProfile) -}}
{{- end -}}
---
apiVersion: metal3.io/v1alpha1
kind: BareMetalHost
@ -53,7 +59,7 @@ template: |
bmc:
address: {{ $host.bmcAddress }}
credentialsName: {{ $hostName }}-bmc-secret
disableCertificateVerification: {{ $host.disableCertificateVerification }}
disableCertificateVerification: {{ default false $host.disableCertificateVerification }}
firmware:
{{ toYaml $hardwareProfile.firmware | indent 4 }}
{{- /* If no raid is defined for a host, simply skip. There is no default setting for raid */ -}}

View File

@ -36,7 +36,7 @@ hosts:
macAddresses:
oam: 52:54:00:9b:27:02
pxe: 52:54:00:b6:ed:02
hardwareProfile: example # defined in the hardwareprofile-example function
hardwareProfile: default
node03:
bootMode: legacy
macAddress: 52:54:00:b6:ed:23