From 18516ee2be9c0ff934f204054dca7788b382c1eb Mon Sep 17 00:00:00 2001 From: "Neely, Travis (tn720x)" Date: Tue, 27 Oct 2020 05:47:37 -0500 Subject: [PATCH] Fix issue in dbutils where do_cleanup runs twice in a row Dbutils for mysql currently experiences a small issues where it will attempt to run the do_cleanup function twice in a row. This would occur when running individual commands in non-interactive mode and using the persistent flag -p for the on-demand pod. Since dbutils requires a namespace to be entered for these commands the code was failing to match and thus running an additional do_cleanup when it was not needed. This was also updated for postgresql so the script matches mysql. Change-Id: I74c3bd948e7bf63caaa3249a486be818698e62b1 --- charts/mysqlclient-utility/templates/bin/utility/_dbutils.tpl | 2 +- charts/postgresql-utility/templates/bin/utility/_dbutils.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/mysqlclient-utility/templates/bin/utility/_dbutils.tpl b/charts/mysqlclient-utility/templates/bin/utility/_dbutils.tpl index dff06b6c..c833f0df 100755 --- a/charts/mysqlclient-utility/templates/bin/utility/_dbutils.tpl +++ b/charts/mysqlclient-utility/templates/bin/utility/_dbutils.tpl @@ -1082,7 +1082,7 @@ function main() { # Arguments are passed, execute the requested command then exit else execute_selection "${ARGS[@]}" - if [[ "${ARGS[@]}" != "c" && "${ARGS[@]}" != "cleanup" && "${ARGS[@]}" != "quit" && "${ARGS[@]}" != "q" ]]; then + if [[ "${ARGS[0]}" != "c" && "${ARGS[0]}" != "cleanup" && "${ARGS[0]}" != "quit" && "${ARGS[0]}" != "q" ]]; then do_cleanup fi echo "Task Complete" diff --git a/charts/postgresql-utility/templates/bin/utility/_dbutils.tpl b/charts/postgresql-utility/templates/bin/utility/_dbutils.tpl index 2e534f1d..32142caf 100755 --- a/charts/postgresql-utility/templates/bin/utility/_dbutils.tpl +++ b/charts/postgresql-utility/templates/bin/utility/_dbutils.tpl @@ -982,7 +982,7 @@ function main() { # Arguments are passed, execute the requested command then exit else execute_selection "${ARGS[@]}" - if [[ "${ARGS[@]}" != "c" && "${ARGS[@]}" != "cleanup" && "${ARGS[@]}" != "quit" && "${ARGS[@]}" != "q" ]]; then + if [[ "${ARGS[0]}" != "c" && "${ARGS[0]}" != "cleanup" && "${ARGS[0]}" != "quit" && "${ARGS[0]}" != "q" ]]; then do_cleanup fi echo "Task Complete"