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/portal/components/portal-mariadb/resources | |
parent | 2f48550414136d6b638d7c05307d17b5361c9757 (diff) | |
parent | f3454863133c2979f5091e6881cde3a496b2e12d (diff) |
Merge "[COMMON] Fix ${!name} bashisms"
Diffstat (limited to 'kubernetes/portal/components/portal-mariadb/resources')
-rw-r--r-- | kubernetes/portal/components/portal-mariadb/resources/config/mariadb/docker-entrypoint.sh | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/kubernetes/portal/components/portal-mariadb/resources/config/mariadb/docker-entrypoint.sh b/kubernetes/portal/components/portal-mariadb/resources/config/mariadb/docker-entrypoint.sh index ebc8ca0f40..411ed8e667 100644 --- a/kubernetes/portal/components/portal-mariadb/resources/config/mariadb/docker-entrypoint.sh +++ b/kubernetes/portal/components/portal-mariadb/resources/config/mariadb/docker-entrypoint.sh @@ -1,4 +1,5 @@ #!/bin/bash + set -eo pipefail shopt -s nullglob @@ -30,10 +31,15 @@ file_env() { mysql_error "Both $var and $fileVar are set (but are exclusive)" fi local val="$def" + # val="${!var}" + # val="$(< "${!fileVar}")" + # eval replacement of the bashism equivalents above presents no security issue here + # since var and fileVar variables contents are derived from the file_env() function arguments. + # This method is only called inside this script with a limited number of possible values. if [ "${!var:-}" ]; then - val="${!var}" + eval val=\$$var elif [ "${!fileVar:-}" ]; then - val="$(< "${!fileVar}")" + val="$(< "$(eval echo "\$$fileVar")")" fi export "$var"="$val" unset "$fileVar" |