39 lines
1.8 KiB
Smarty
39 lines
1.8 KiB
Smarty
{{/*
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
|
|
`SPDX-License-Identifier: Apache-2.0`
|
|
|
|
This file is considered to be modified by the TrueCharts Project.
|
|
*/}}
|
|
|
|
{{/* vim: set filetype=mustache: */}}
|
|
{{/*
|
|
Through error when upgrading using empty passwords values that must not be empty.
|
|
|
|
Usage:
|
|
{{- $validationError00 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password00" "secret" "secretName" "field" "password-00") -}}
|
|
{{- $validationError01 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password01" "secret" "secretName" "field" "password-01") -}}
|
|
{{ include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $validationError00 $validationError01) "context" $) }}
|
|
|
|
Required password params:
|
|
- validationErrors - String - Required. List of validation strings to be return, if it is empty it won't throw error.
|
|
- context - Context - Required. Parent context.
|
|
*/}}
|
|
{{- define "common.errors.upgrade.passwords.empty" -}}
|
|
{{- $validationErrors := join "" .validationErrors -}}
|
|
{{- if and $validationErrors .context.Release.IsUpgrade -}}
|
|
{{- $errorString := "\nPASSWORDS ERROR: you must provide your current passwords when upgrade the release%s" -}}
|
|
{{- printf $errorString $validationErrors | fail -}}
|
|
{{- end -}}
|
|
{{- end -}}
|