diff --git a/templates/configmaps/pre-delete.yaml b/templates/configmaps/pre-delete.yaml index a1cc72884..a72a933d7 100644 --- a/templates/configmaps/pre-delete.yaml +++ b/templates/configmaps/pre-delete.yaml @@ -34,6 +34,8 @@ data: if [ $? -ne 0 ]; then echo -e "\e[0;31m DB is not available \e[0m" exit 1 + else + echo -e "\e[0;32m Successful connection to the DB \e[0m" fi {{- if not .Values.persistence.storageS3 }} FILES_DIR=/var/lib/{{ .Values.product.name }}/documentserver/App_Data/cache/files/ @@ -67,6 +69,7 @@ data: --port={{ .Values.connections.dbPort }} \ --user={{ .Values.connections.dbUser }} \ --dbname={{ .Values.connections.dbName }} \ + --variable=ON_ERROR_STOP=ON \ --file=/scripts/{{ .Values.delete.existingConfigmap.tblRemove.keyName }} {{- else if or (eq .Values.connections.dbType "mysql") (eq .Values.connections.dbType "mariadb") }} mysql -h {{ .Values.connections.dbHost }} \ @@ -75,5 +78,8 @@ data: -p$DB_PWD \ {{ .Values.connections.dbName }} < /scripts/{{ .Values.delete.existingConfigmap.tblRemove.keyName }} {{- end }} + if [ $? -ne 0 ]; then + echo -e "\e[0;31m The DATABASE cleanup script could not be executed. Skipping... \e[0m" + fi echo work done {{- end }} diff --git a/templates/configmaps/pre-install.yaml b/templates/configmaps/pre-install.yaml index 7e98ba116..bcae0bae7 100644 --- a/templates/configmaps/pre-install.yaml +++ b/templates/configmaps/pre-install.yaml @@ -33,6 +33,8 @@ data: if [ $? -ne 0 ]; then echo -e "\e[0;31m DB is not available \e[0m" exit 1 + else + echo -e "\e[0;32m Successful connection to the database \e[0m" fi if [[ "$PRIVATE_CLUSTER" != "true" ]]; then wget -O /scripts/{{ .Values.install.existingConfigmap.tblCreate.keyName }} \ @@ -47,6 +49,7 @@ data: --port={{ .Values.connections.dbPort }} \ --user={{ .Values.connections.dbUser }} \ --dbname={{ .Values.connections.dbName }} \ + --variable=ON_ERROR_STOP=ON \ --file=/scripts/{{ .Values.install.existingConfigmap.tblCreate.keyName }} {{- else if or (eq .Values.connections.dbType "mysql") (eq .Values.connections.dbType "mariadb") }} mysql -h {{ .Values.connections.dbHost }} \ @@ -55,5 +58,9 @@ data: -p$DB_PWD \ {{ .Values.connections.dbName }} < /scripts/{{ .Values.install.existingConfigmap.tblCreate.keyName }} {{- end }} + if [ $? -ne 0 ]; then + echo -e "\e[0;31m The DATABASE initialization script could not be executed \e[0m" + exit 1 + fi echo work done {{- end }} diff --git a/templates/configmaps/pre-rollback.yaml b/templates/configmaps/pre-rollback.yaml index 722eeea75..bc782da67 100644 --- a/templates/configmaps/pre-rollback.yaml +++ b/templates/configmaps/pre-rollback.yaml @@ -33,6 +33,8 @@ data: if [ $? -ne 0 ]; then echo -e "\e[0;31m DB is not available \e[0m" exit 1 + else + echo -e "\e[0;32m Successful connection to the DB \e[0m" fi {{- if not .Values.persistence.storageS3 }} FILES_DIR=/var/lib/{{ .Values.product.name }}/documentserver/App_Data/cache/files/ @@ -72,11 +74,13 @@ data: --port={{ .Values.connections.dbPort }} \ --user={{ .Values.connections.dbUser }} \ --dbname={{ .Values.connections.dbName }} \ + --variable=ON_ERROR_STOP=ON \ --file=/scripts/{{ .Values.rollback.existingConfigmap.tblRemove.keyName }} PGPASSWORD=$DB_PWD psql --host={{ .Values.connections.dbHost }} \ --port={{ .Values.connections.dbPort }} \ --user={{ .Values.connections.dbUser }} \ --dbname={{ .Values.connections.dbName }} \ + --variable=ON_ERROR_STOP=ON \ --file=/scripts/{{ .Values.rollback.existingConfigmap.tblCreate.keyName }} {{- else if or (eq .Values.connections.dbType "mysql") (eq .Values.connections.dbType "mariadb") }} mysql -h {{ .Values.connections.dbHost }} \ @@ -90,5 +94,9 @@ data: -p$DB_PWD \ {{ .Values.connections.dbName }} < /scripts/{{ .Values.rollback.existingConfigmap.tblCreate.keyName }} {{- end }} + if [ $? -ne 0 ]; then + echo -e "\e[0;31m The DATABASE preparation scripts could not be executed \e[0m" + exit 1 + fi echo work done {{- end }} diff --git a/templates/configmaps/pre-upgrade.yaml b/templates/configmaps/pre-upgrade.yaml index 310f7d99e..3ecc495ee 100644 --- a/templates/configmaps/pre-upgrade.yaml +++ b/templates/configmaps/pre-upgrade.yaml @@ -38,6 +38,8 @@ data: if [ $? -ne 0 ]; then echo -e "\e[0;31m DB is not available \e[0m" exit 1 + else + echo -e "\e[0;32m Successful connection to the DB \e[0m" fi if [[ "$PRIVATE_CLUSTER" != "true" ]]; then wget -O /scripts/{{ .Values.upgrade.existingConfigmap.tblRemove.keyName }} \ @@ -58,11 +60,13 @@ data: --port={{ .Values.connections.dbPort }} \ --user={{ .Values.connections.dbUser }} \ --dbname={{ .Values.connections.dbName }} \ + --variable=ON_ERROR_STOP=ON \ --file=/scripts/{{ .Values.upgrade.existingConfigmap.tblRemove.keyName }} PGPASSWORD=$DB_PWD psql --host={{ .Values.connections.dbHost }} \ --port={{ .Values.connections.dbPort }} \ --user={{ .Values.connections.dbUser }} \ --dbname={{ .Values.connections.dbName }} \ + --variable=ON_ERROR_STOP=ON \ --file=/scripts/{{ .Values.upgrade.existingConfigmap.tblCreate.keyName }} {{- else if or (eq .Values.connections.dbType "mysql") (eq .Values.connections.dbType "mariadb") }} mysql -h {{ .Values.connections.dbHost }} \ @@ -76,6 +80,10 @@ data: -p$DB_PWD \ {{ .Values.connections.dbName }} < /scripts/{{ .Values.upgrade.existingConfigmap.tblCreate.keyName }} {{- end }} + if [ $? -ne 0 ]; then + echo -e "\e[0;31m The DATABASE preparation scripts could not be executed \e[0m" + exit 1 + fi echo work done fi {{- end }}