From 2fc1ce4a142e605a9fc6c90dceabbf7c4bfb81e3 Mon Sep 17 00:00:00 2001 From: "Lo, Chi (cl566n)" Date: Tue, 22 Feb 2022 15:17:19 -0800 Subject: [PATCH] Removing -x from database backup script The set -x has produced 6 identical log strings every time the log_backup_error_exit function is called. Prometheus is using the occurrence and number of some logs over a period of time to evaluate database backup failure or not. Only one log should be generated when a particular database backup scenario failed. Upon discussion with database backup and restore SME, it is recommended to remove the set -x once and for all. Change-Id: I846b5c16908f04ac40ee8f4d87d3b7df86036512 --- helm-toolkit/Chart.yaml | 2 +- .../scripts/db-backup-restore/_backup_main.sh.tpl | 9 --------- mariadb/Chart.yaml | 2 +- mariadb/templates/bin/_backup_mariadb.sh.tpl | 1 - postgresql/Chart.yaml | 2 +- postgresql/templates/bin/_backup_postgresql.sh.tpl | 1 - releasenotes/notes/helm-toolkit.yaml | 1 + releasenotes/notes/mariadb.yaml | 1 + releasenotes/notes/postgresql.yaml | 1 + 9 files changed, 6 insertions(+), 14 deletions(-) diff --git a/helm-toolkit/Chart.yaml b/helm-toolkit/Chart.yaml index 01f56be6d..572d832b0 100644 --- a/helm-toolkit/Chart.yaml +++ b/helm-toolkit/Chart.yaml @@ -15,7 +15,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Helm-Toolkit name: helm-toolkit -version: 0.2.32 +version: 0.2.33 home: https://docs.openstack.org/openstack-helm icon: https://www.openstack.org/themes/openstack/images/project-mascots/OpenStack-Helm/OpenStack_Project_OpenStackHelm_vertical.png sources: diff --git a/helm-toolkit/templates/scripts/db-backup-restore/_backup_main.sh.tpl b/helm-toolkit/templates/scripts/db-backup-restore/_backup_main.sh.tpl index bee9f068f..052604b19 100755 --- a/helm-toolkit/templates/scripts/db-backup-restore/_backup_main.sh.tpl +++ b/helm-toolkit/templates/scripts/db-backup-restore/_backup_main.sh.tpl @@ -80,7 +80,6 @@ # Note: not using set -e in this script because more elaborate error handling # is needed. -set -x log_backup_error_exit() { MSG=$1 @@ -379,13 +378,11 @@ backup_databases() { # This error should print first, then print the summary as the last # thing that the user sees in the output. log ERROR "${DB_NAME}_backup" "Backup ${TARBALL_FILE} could not be sent to remote RGW." - set +x echo "==================================================================" echo "Local backup successful, but could not send to remote RGW." echo "Backup archive name: $TARBALL_FILE" echo "Backup archive size: $ARCHIVE_SIZE" echo "==================================================================" - set -x # Because the local backup was successful, exit with 0 so the pod will not # continue to restart and fill the disk with more backups. The ERRORs are # logged and alerting system should catch those errors and flag the operator. @@ -397,26 +394,20 @@ backup_databases() { remove_old_remote_archives fi - # Turn off trace just for a clearer printout of backup status - for manual backups, mainly. - set +x echo "==================================================================" echo "Local backup and backup to remote RGW successful!" echo "Backup archive name: $TARBALL_FILE" echo "Backup archive size: $ARCHIVE_SIZE" echo "==================================================================" - set -x else # Remote backup is not enabled. This is ok; at least we have a local backup. log INFO "${DB_NAME}_backup" "Skipping remote backup, as it is not enabled." - # Turn off trace just for a clearer printout of backup status - for manual backups, mainly. - set +x echo "==================================================================" echo "Local backup successful!" echo "Backup archive name: $TARBALL_FILE" echo "Backup archive size: $ARCHIVE_SIZE" echo "==================================================================" - set -x fi } {{- end }} diff --git a/mariadb/Chart.yaml b/mariadb/Chart.yaml index 2e4f4b957..02eb7d49e 100644 --- a/mariadb/Chart.yaml +++ b/mariadb/Chart.yaml @@ -15,7 +15,7 @@ apiVersion: v1 appVersion: v10.2.31 description: OpenStack-Helm MariaDB name: mariadb -version: 0.2.11 +version: 0.2.12 home: https://mariadb.com/kb/en/ icon: http://badges.mariadb.org/mariadb-badge-180x60.png sources: diff --git a/mariadb/templates/bin/_backup_mariadb.sh.tpl b/mariadb/templates/bin/_backup_mariadb.sh.tpl index b83c865d5..dc44a2631 100644 --- a/mariadb/templates/bin/_backup_mariadb.sh.tpl +++ b/mariadb/templates/bin/_backup_mariadb.sh.tpl @@ -13,7 +13,6 @@ SCOPE=${1:-"all"} # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -set -x source /tmp/backup_main.sh diff --git a/postgresql/Chart.yaml b/postgresql/Chart.yaml index 1f7b5ce26..aa5f11ac4 100644 --- a/postgresql/Chart.yaml +++ b/postgresql/Chart.yaml @@ -15,7 +15,7 @@ apiVersion: v1 appVersion: v9.6 description: OpenStack-Helm PostgreSQL name: postgresql -version: 0.1.12 +version: 0.1.13 home: https://www.postgresql.org sources: - https://github.com/postgres/postgres diff --git a/postgresql/templates/bin/_backup_postgresql.sh.tpl b/postgresql/templates/bin/_backup_postgresql.sh.tpl index 12ebdd7a9..7d85b9eb4 100755 --- a/postgresql/templates/bin/_backup_postgresql.sh.tpl +++ b/postgresql/templates/bin/_backup_postgresql.sh.tpl @@ -22,7 +22,6 @@ export PGPASSWORD=$(cat /etc/postgresql/admin_user.conf \ # Note: not using set -e in this script because more elaborate error handling # is needed. -set -x source /tmp/backup_main.sh diff --git a/releasenotes/notes/helm-toolkit.yaml b/releasenotes/notes/helm-toolkit.yaml index 62b4a984d..53cd743a5 100644 --- a/releasenotes/notes/helm-toolkit.yaml +++ b/releasenotes/notes/helm-toolkit.yaml @@ -39,4 +39,5 @@ helm-toolkit: - 0.2.30 Add ability to image pull secrets on pods - 0.2.31 Add log strings for alert generation - 0.2.32 Consolidate mon_endpoints discovery + - 0.2.33 Remove set -x ... diff --git a/releasenotes/notes/mariadb.yaml b/releasenotes/notes/mariadb.yaml index 6ef7a254a..ab06752f5 100644 --- a/releasenotes/notes/mariadb.yaml +++ b/releasenotes/notes/mariadb.yaml @@ -27,4 +27,5 @@ mariadb: - 0.2.9 Update htk requirements - 0.2.10 Fix Python exceptions - 0.2.11 Enhance mariadb backup + - 0.2.12 Remove set -x ... diff --git a/releasenotes/notes/postgresql.yaml b/releasenotes/notes/postgresql.yaml index b990adfc6..5119ec9da 100644 --- a/releasenotes/notes/postgresql.yaml +++ b/releasenotes/notes/postgresql.yaml @@ -13,4 +13,5 @@ postgresql: - 0.1.10 Helm 3 - Fix Job labels - 0.1.11 Update htk requirements - 0.1.12 Enhance postgresql backup + - 0.1.13 Remove set -x ...