d6d3ec65a10c0181a3b36a6f570458d3b73edb7e
[demo.git] / tutorials / ApacheCNF / templates / cba / Templates / k8s-configs / deployment-config / charts / common / templates / _errors.tpl
1 {{/* vim: set filetype=mustache: */}}
2 {{/*
3 Through error when upgrading using empty passwords values that must not be empty.
4
5 Usage:
6 {{- $validationError00 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password00" "secret" "secretName" "field" "password-00") -}}
7 {{- $validationError01 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password01" "secret" "secretName" "field" "password-01") -}}
8 {{ include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $validationError00 $validationError01) "context" $) }}
9
10 Required password params:
11   - validationErrors - String - Required. List of validation strings to be return, if it is empty it won't throw error.
12   - context - Context - Required. Parent context.
13 */}}
14 {{- define "common.errors.upgrade.passwords.empty" -}}
15   {{- $validationErrors := join "" .validationErrors -}}
16   {{- if and $validationErrors .context.Release.IsUpgrade -}}
17     {{- $errorString := "\nPASSWORDS ERROR: you must provide your current passwords when upgrade the release%s" -}}
18     {{- printf $errorString $validationErrors | fail -}}
19   {{- end -}}
20 {{- end -}}