Merge "[DCAEGEN2] Upgrade vescollector to 1.9.2"
[oom.git] / kubernetes / common / common / templates / _createPassword.tpl
index 938b0ee..4ded11f 100644 (file)
 */}}
 {{- define "common.masterPassword" -}}
   {{ if .Values.masterPasswordOverride }}
-    {{- printf "%d" .Values.masterPasswordOverride -}}
+    {{- printf "%s" .Values.masterPasswordOverride -}}
   {{ else if .Values.global.masterPassword }}
-    {{- printf "%d" .Values.global.masterPassword -}}
+    {{- printf "%s" .Values.global.masterPassword -}}
   {{ else if .Values.masterPassword }}
-    {{- printf "%d" .Values.masterPassword -}}
+    {{- printf "%s" .Values.masterPassword -}}
+  {{ else if eq "testRelease" (include "common.release" .) }}
+    {{/* Special case for chart liniting. DON"T NAME YOUR PRODUCTION RELEASE testRelease */}}
+    {{- printf "testRelease" -}}
+  {{ else if eq "test-release" .Release.Name }}
+    {{/* Special case for chart linting in helm3. DON"T NAME YOUR PRODUCTION RELEASE test-release */}}
+    {{- printf "testRelease" -}}
   {{ else }}
     {{ fail "masterPassword not provided" }}
   {{ end }}
 {{- end -}}
 
+{{- define "common._defaultPasswordStrength" -}}
+  {{ if .Values.passwordStrengthOverride }}
+    {{- printf "%s" .Values.passwordStrengthOverride -}}
+  {{ else if .Values.global.passwordStrength }}
+    {{- printf "%s" .Values.global.passwordStrength -}}
+  {{ else if .Values.passwordStrength }}
+    {{- printf "%s" .Values.passwordStrength -}}
+  {{ else }}
+    {{- printf "long" }}
+  {{ end }}
+{{- end -}}
+
 {{/*
   Generate a new password based on masterPassword. The new password is not
   random, it is derived from masterPassword, fully qualified chart name and
@@ -56,7 +74,8 @@
 {{- define "common.createPassword" -}}
   {{- $dot := default . .dot -}}
   {{- $uid := default "onap" .uid -}}
-  {{- $strength := default "long" .strength -}}
+  {{- $defaultStrength := include "common._defaultPasswordStrength" $dot | trim -}}
+  {{- $strength := default $defaultStrength .strength -}}
   {{- $mp := include "common.masterPassword" $dot -}}
   {{- derivePassword 1 $strength $mp (include "common.fullname" $dot) $uid -}}
 {{- end -}}