From 4a490b894ce2a3c547075a5559de58fd07124401 Mon Sep 17 00:00:00 2001 From: "Neely, Travis (tn720x)" Date: Sun, 26 Sep 2021 16:04:23 -0500 Subject: [PATCH] Fix issue with db backup error return code being eaten The return code from the send_to_remote_server function are being eaten by an if statement and thus we never hit the elif section of code. Change-Id: Id3e256c991421ad6624713f65212abb4881240c1 --- helm-toolkit/Chart.yaml | 2 +- .../templates/scripts/db-backup-restore/_backup_main.sh.tpl | 5 +++-- releasenotes/notes/helm-toolkit.yaml | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/helm-toolkit/Chart.yaml b/helm-toolkit/Chart.yaml index 70f119b53..2ee0787b4 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.20 +version: 0.2.21 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 7c62bc426..03d3dc9a8 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 @@ -210,12 +210,13 @@ store_backup_remotely() { while [[ $DONE == "false" ]]; do # Store the new archive to the remote backup storage facility. send_to_remote_server $FILEPATH $FILE + SEND_RESULT="$?" # Check if successful - if [[ $? -eq 0 ]]; then + if [[ $SEND_RESULT -eq 0 ]]; then log INFO "${DB_NAME}_backup" "Backup file ${FILE} successfully sent to RGW." DONE=true - elif [[ $? -eq 2 ]]; then + elif [[ $SEND_RESULT -eq 2 ]]; then # Temporary failure occurred. We need to retry if we have not timed out log WARN "${DB_NAME}_backup" "Backup file ${FILE} could not be sent to RGW due to connection issue." DELTA=$(( TIMEOUT_EXP - $(date +%s) )) diff --git a/releasenotes/notes/helm-toolkit.yaml b/releasenotes/notes/helm-toolkit.yaml index 24eacf1fa..951996d79 100644 --- a/releasenotes/notes/helm-toolkit.yaml +++ b/releasenotes/notes/helm-toolkit.yaml @@ -27,4 +27,5 @@ helm-toolkit: - 0.2.18 Make Rabbit-init job more robust - 0.2.19 Revoke all privileges for PUBLIC role in postgres dbs - 0.2.20 Modify the template of rbac_role to make secrets accessible + - 0.2.21 Fix issue with db backup error return code being eaten ...