diff options
author | Sylvain Desbureaux <sylvain.desbureaux@orange.com> | 2021-06-21 13:41:19 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-06-21 13:41:19 +0000 |
commit | 8e032164e936cd0d1ee22737eebeabfe9fda58c7 (patch) | |
tree | 67a249c57abed30adcb46aaba5fae8f8250aa5e5 /kubernetes/common/mariadb-init/resources/config | |
parent | 2f48550414136d6b638d7c05307d17b5361c9757 (diff) | |
parent | f3454863133c2979f5091e6881cde3a496b2e12d (diff) |
Merge "[COMMON] Fix ${!name} bashisms"
Diffstat (limited to 'kubernetes/common/mariadb-init/resources/config')
-rwxr-xr-x | kubernetes/common/mariadb-init/resources/config/db_init.sh | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/kubernetes/common/mariadb-init/resources/config/db_init.sh b/kubernetes/common/mariadb-init/resources/config/db_init.sh index fa4b007a5a..f130bb5118 100755 --- a/kubernetes/common/mariadb-init/resources/config/db_init.sh +++ b/kubernetes/common/mariadb-init/resources/config/db_init.sh @@ -1,4 +1,5 @@ #!/bin/bash + {{/* # Copyright © 2019 Orange # Copyright © 2020 Samsung Electronics @@ -22,8 +23,15 @@ set -e while read DB ; do USER_VAR="MYSQL_USER_${DB^^}" PASS_VAR="MYSQL_PASSWORD_${DB^^}" - USER=${!USER_VAR} - PASS=`echo -n ${!PASS_VAR} | sed -e "s/'/''/g"` +{{/* + # USER=${!USER_VAR} + # PASS=`echo -n ${!PASS_VAR} | sed -e "s/'/''/g"` + # eval replacement of the bashism equivalents above might present a security issue here + # since it reads content from DB values filled by helm at the end of the script. + # These possible values has to be constrainted and/or limited by helm for a safe use of eval. +*/}} + eval USER=\$$USER_VAR + PASS=$(eval echo -n \$$PASS_VAR | sed -e "s/'/''/g") MYSQL_OPTS=( -h ${DB_HOST} -P ${DB_PORT} -uroot -p${MYSQL_ROOT_PASSWORD} ) echo "Creating database ${DB} and user ${USER}..." |