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
This commit is contained in:
Lo, Chi (cl566n) 2022-02-22 15:17:19 -08:00
parent 110575049b
commit 2fc1ce4a14
9 changed files with 6 additions and 14 deletions

View File

@ -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:

View File

@ -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 }}

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
...

View File

@ -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
...

View File

@ -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
...