From f7e29c849f5f75ee0629215af67becb937afcd93 Mon Sep 17 00:00:00 2001 From: Chris Johnson Date: Fri, 19 Mar 2021 02:33:18 -0400 Subject: [PATCH 1/3] Fix --variables_to_replace When passing --variables_to_replace, the value was not being passed into the nested calls which means they were effectively not being applied at all. Presumably all current usage of dbdeployer is passing variables_to_replace in via config files instead of command-line arguments, but my needs don't easily allow for configuration via file --- dbdeployer | 1 + functions/deployment_report.sh | 4 ++-- functions/update_db_to_current.sh | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dbdeployer b/dbdeployer index 4f3060c..5061b7e 100755 --- a/dbdeployer +++ b/dbdeployer @@ -157,6 +157,7 @@ do -o|--variables_to_replace) shift variables_to_replace="${1}" + variables_to_replace_cli="${1}" shift ;; -p|--port) diff --git a/functions/deployment_report.sh b/functions/deployment_report.sh index 5f6d406..9f1f5ef 100644 --- a/functions/deployment_report.sh +++ b/functions/deployment_report.sh @@ -21,7 +21,7 @@ deployment_report() { do if ! [ -z "${x}" ] then - echo "${script_name} -f "${x}" -n "${db_destination_name}" ${run_as_cli} ${environment_flag} ${server_cli} ${port_cli} ${dbuser_cli} ${password_cli} ${skip_cli} ${dbtype_cli} ${confirm_cli}" + echo "${script_name} -f "${x}" -n "${db_destination_name}" ${run_as_cli} ${environment_flag} ${server_cli} ${port_cli} ${dbuser_cli} ${password_cli} ${skip_cli} ${dbtype_cli} ${confirm_cli}" --variables_to_replace "$variables_to_replace_cli" let "pending_count++" fi done @@ -81,7 +81,7 @@ deployment_report() { if ! [ -z "${x}" ] then auto_deploy_file=`echo ${x} | awk -F '--dbdeployer-md5sum--' {'print $1'}` - echo "${script_name} -f "${auto_deploy_file}" -c -n "${db_destination_name}" ${run_as_cli} ${environment_flag} ${server_cli} ${port_cli} ${dbuser_cli} ${password_cli} ${skip_cli} ${dbtype_cli}" + echo "${script_name} -f "${auto_deploy_file}" -c -n "${db_destination_name}" ${run_as_cli} ${environment_flag} ${server_cli} ${port_cli} ${dbuser_cli} ${password_cli} ${skip_cli} ${dbtype_cli}" --variables_to_replace "$variables_to_replace_cli" let "pending_count++" fi done diff --git a/functions/update_db_to_current.sh b/functions/update_db_to_current.sh index 7c242c3..3dcc640 100644 --- a/functions/update_db_to_current.sh +++ b/functions/update_db_to_current.sh @@ -6,7 +6,7 @@ function update_db_to_current() { #echo "report_var executes: ${script_name} ${run_as_cli} -D ${db_basedir} -r -d \"${_dbname}\" -n \"${_db_destination_name}\" ${environment_flag} ${server_cli} ${port_cli} ${dbuser_cli} ${password_cli} ${skip_cli} ${dbtype_cli} ${module_list_cli} ${confirm_cli} | grep \"${script_name} -f\"" - report_var=`${script_name} ${run_as_cli} -D ${db_basedir} -r -d "${_dbname}" -n "${_db_destination_name}" ${environment_flag} ${server_cli} ${port_cli} ${dbuser_cli} ${password_cli} ${skip_cli} ${dbtype_cli} ${module_list_cli} ${confirm_cli} | grep "${script_name} -f"` + report_var=`${script_name} ${run_as_cli} -D ${db_basedir} -r -d "${_dbname}" -n "${_db_destination_name}" ${environment_flag} ${server_cli} ${port_cli} ${dbuser_cli} ${password_cli} ${skip_cli} ${dbtype_cli} ${module_list_cli} ${confirm_cli} --variables_to_replace "'${variables_to_replace_cli}'" | grep "${script_name} -f"` local IFS=$'\n' for j in `echo -e "${report_var}"` do From 5c5c5136ce14a364ae3f673aff7bfa970fe2706e Mon Sep 17 00:00:00 2001 From: CJ Estel Date: Wed, 31 Mar 2021 16:08:01 -0400 Subject: [PATCH 2/3] Bug fix for variables to replace --- CHANGELOG.md | 7 +++++++ dbdeployer_release | 2 +- functions/deployment_report.sh | 4 ++-- functions/update_db_to_current.sh | 3 ++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5bf5be..19c7b89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 2021-03-31 Release 1.5.10 +### Summary +Bug Fix + +### Changes + - variables_to_replace did not pass through to sub calls when passed on cli + ## 2020-06-25 Release 1.5.9 ### Summary Security Fix diff --git a/dbdeployer_release b/dbdeployer_release index 40e1bf6..aa0b293 100644 --- a/dbdeployer_release +++ b/dbdeployer_release @@ -1 +1 @@ -version=1.5.9 +version=1.5.10 diff --git a/functions/deployment_report.sh b/functions/deployment_report.sh index 9f1f5ef..01d134f 100644 --- a/functions/deployment_report.sh +++ b/functions/deployment_report.sh @@ -21,7 +21,7 @@ deployment_report() { do if ! [ -z "${x}" ] then - echo "${script_name} -f "${x}" -n "${db_destination_name}" ${run_as_cli} ${environment_flag} ${server_cli} ${port_cli} ${dbuser_cli} ${password_cli} ${skip_cli} ${dbtype_cli} ${confirm_cli}" --variables_to_replace "$variables_to_replace_cli" + echo "${script_name} -f ${x} -n ${db_destination_name} -o '${variables_to_replace}' ${run_as_cli} ${environment_flag} ${server_cli} ${port_cli} ${dbuser_cli} ${password_cli} ${skip_cli} ${dbtype_cli} ${confirm_cli}" let "pending_count++" fi done @@ -81,7 +81,7 @@ deployment_report() { if ! [ -z "${x}" ] then auto_deploy_file=`echo ${x} | awk -F '--dbdeployer-md5sum--' {'print $1'}` - echo "${script_name} -f "${auto_deploy_file}" -c -n "${db_destination_name}" ${run_as_cli} ${environment_flag} ${server_cli} ${port_cli} ${dbuser_cli} ${password_cli} ${skip_cli} ${dbtype_cli}" --variables_to_replace "$variables_to_replace_cli" + echo "${script_name} -f ${auto_deploy_file} -c -n ${db_destination_name} -o '${variables_to_replace}' ${run_as_cli} ${environment_flag} ${server_cli} ${port_cli} ${dbuser_cli} ${password_cli} ${skip_cli} ${dbtype_cli}" let "pending_count++" fi done diff --git a/functions/update_db_to_current.sh b/functions/update_db_to_current.sh index 3dcc640..ee9eb85 100644 --- a/functions/update_db_to_current.sh +++ b/functions/update_db_to_current.sh @@ -6,7 +6,8 @@ function update_db_to_current() { #echo "report_var executes: ${script_name} ${run_as_cli} -D ${db_basedir} -r -d \"${_dbname}\" -n \"${_db_destination_name}\" ${environment_flag} ${server_cli} ${port_cli} ${dbuser_cli} ${password_cli} ${skip_cli} ${dbtype_cli} ${module_list_cli} ${confirm_cli} | grep \"${script_name} -f\"" - report_var=`${script_name} ${run_as_cli} -D ${db_basedir} -r -d "${_dbname}" -n "${_db_destination_name}" ${environment_flag} ${server_cli} ${port_cli} ${dbuser_cli} ${password_cli} ${skip_cli} ${dbtype_cli} ${module_list_cli} ${confirm_cli} --variables_to_replace "'${variables_to_replace_cli}'" | grep "${script_name} -f"` + report_var=`${script_name} ${run_as_cli} -D ${db_basedir} -r -d "${_dbname}" -n "${_db_destination_name}" -o ${variables_to_replace} ${environment_flag} ${server_cli} ${port_cli} ${dbuser_cli} ${password_cli} ${skip_cli} ${dbtype_cli} ${module_list_cli} ${confirm_cli} | grep "${script_name} -f"` + local IFS=$'\n' for j in `echo -e "${report_var}"` do From 7685b262012a1d1917892aab9649f404b0428970 Mon Sep 17 00:00:00 2001 From: CJ Estel Date: Wed, 31 Mar 2021 16:18:49 -0400 Subject: [PATCH 3/3] revert change to cli option as it ended up not needed --- dbdeployer | 1 - 1 file changed, 1 deletion(-) diff --git a/dbdeployer b/dbdeployer index 5061b7e..4f3060c 100755 --- a/dbdeployer +++ b/dbdeployer @@ -157,7 +157,6 @@ do -o|--variables_to_replace) shift variables_to_replace="${1}" - variables_to_replace_cli="${1}" shift ;; -p|--port)