chore(enabled): make sure the key always exist

This commit is contained in:
Stavros kois
2024-03-10 15:03:08 +02:00
parent 98ac79aa80
commit e5ec0a1800
2 changed files with 9 additions and 7 deletions

View File

@@ -15,7 +15,7 @@ maintainers:
name: common
sources: null
type: library
version: 19.1.1
version: 19.1.2
annotations:
artifacthub.io/category: "integration-delivery"
artifacthub.io/license: "BUSL-1.1"

View File

@@ -6,12 +6,14 @@
{{- $caller := .caller -}}
{{- $enabled := false -}}
{{- if hasKey $objectData "enabled" -}}
{{- if not (kindIs "invalid" $objectData.enabled) -}}
{{- $enabled = $objectData.enabled -}}
{{- else -}}
{{- fail (printf "%s - Expected the defined key [enabled] in [%s.%s] to not be empty" $caller $key $name) -}}
{{- end -}}
{{- if not (hasKey $objectData "enabled") -}}
{{- fail (printf "%s - Expected the key [enabled] in [%s.%s] to exist" $caller $key $name) -}}
{{- end -}}
{{- if not (kindIs "invalid" $objectData.enabled) -}}
{{- $enabled = $objectData.enabled -}}
{{- else -}}
{{- fail (printf "%s - Expected the defined key [enabled] in [%s.%s] to not be empty" $caller $key $name) -}}
{{- end -}}
{{- if kindIs "string" $enabled -}}