Merge "[AAI] Add model-loader tracing config"
[oom.git] / kubernetes / common / mongodb / common / templates / _errors.tpl
1 {{/*
2 Copyright VMware, Inc.
3 SPDX-License-Identifier: APACHE-2.0
4 */}}
5
6 {{/* vim: set filetype=mustache: */}}
7 {{/*
8 Through error when upgrading using empty passwords values that must not be empty.
9
10 Usage:
11 {{- $validationError00 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password00" "secret" "secretName" "field" "password-00") -}}
12 {{- $validationError01 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password01" "secret" "secretName" "field" "password-01") -}}
13 {{ include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $validationError00 $validationError01) "context" $) }}
14
15 Required password params:
16   - validationErrors - String - Required. List of validation strings to be return, if it is empty it won't throw error.
17   - context - Context - Required. Parent context.
18 */}}
19 {{- define "common.errors.upgrade.passwords.empty" -}}
20   {{- $validationErrors := join "" .validationErrors -}}
21   {{- if and $validationErrors .context.Release.IsUpgrade -}}
22     {{- $errorString := "\nPASSWORDS ERROR: You must provide your current passwords when upgrading the release." -}}
23     {{- $errorString = print $errorString "\n                 Note that even after reinstallation, old credentials may be needed as they may be kept in persistent volume claims." -}}
24     {{- $errorString = print $errorString "\n                 Further information can be obtained at https://docs.bitnami.com/general/how-to/troubleshoot-helm-chart-issues/#credential-errors-while-upgrading-chart-releases" -}}
25     {{- $errorString = print $errorString "\n%s" -}}
26     {{- printf $errorString $validationErrors | fail -}}
27   {{- end -}}
28 {{- end -}}