aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvain Desbureaux <sylvain.desbureaux@orange.com>2020-07-08 06:42:08 +0000
committerGerrit Code Review <gerrit@onap.org>2020-07-08 06:42:08 +0000
commit5380bdf83a505cb6dad85bc32bfbda7e31d0d428 (patch)
tree78763bcec3cb0983b4a1d5d1d873878e53fb70fa
parent633bd25395e1d5cbdf9a8ca739ccf471d0e0aa84 (diff)
parent5ddae22b9767b8083def17fe580a6dfc40f7b5d9 (diff)
Merge "[COMMON] Allow to use ' in mariadb-init" into frankfurt
-rwxr-xr-xkubernetes/common/mariadb-init/resources/config/db_init.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/kubernetes/common/mariadb-init/resources/config/db_init.sh b/kubernetes/common/mariadb-init/resources/config/db_init.sh
index b2fdb14b12..40254d469b 100755
--- a/kubernetes/common/mariadb-init/resources/config/db_init.sh
+++ b/kubernetes/common/mariadb-init/resources/config/db_init.sh
@@ -14,11 +14,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+# make sure the script fails if any of commands failed
+set -e
+
while read DB ; do
USER_VAR="MYSQL_USER_${DB^^}"
PASS_VAR="MYSQL_PASSWORD_${DB^^}"
USER=${!USER_VAR}
- PASS=${!PASS_VAR}
+ PASS=`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}..."