From 1c5a3eb37ce3eeb4ad8f9f9d3fe2341e32229241 Mon Sep 17 00:00:00 2001 From: jjansen23 Date: Fri, 7 May 2021 13:31:55 -0400 Subject: [PATCH 1/6] cleanup files created by deploy.sh #192 --- src/clean.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/clean.sh b/src/clean.sh index cdb55c4a0..462c4ba6e 100755 --- a/src/clean.sh +++ b/src/clean.sh @@ -98,3 +98,5 @@ echo "INFO: destroying Terraform using ${mlz_config_file} and ${tfvars_path}..." # clean up MLZ config resources echo "INFO: cleaning up MLZ resources with tag 'DeploymentName=${mlz_env_name}'..." . "${this_script_path}/scripts/config/config_clean.sh" "${mlz_config_file}" +# clean up reources that was created by deploy.sh +rm -rf "${configuration_output_path}/${mlz_env_name}.mlzconfig" "${configuration_output_path}/${tfvars_filename}" \ No newline at end of file From 21e0f7b10a49109c0d34f7b9df027908df1708e0 Mon Sep 17 00:00:00 2001 From: jjansen23 Date: Mon, 10 May 2021 06:20:22 -0400 Subject: [PATCH 2/6] removing all components .tfvars files --- src/clean.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/clean.sh b/src/clean.sh index 462c4ba6e..76ebcfffb 100755 --- a/src/clean.sh +++ b/src/clean.sh @@ -99,4 +99,5 @@ echo "INFO: destroying Terraform using ${mlz_config_file} and ${tfvars_path}..." echo "INFO: cleaning up MLZ resources with tag 'DeploymentName=${mlz_env_name}'..." . "${this_script_path}/scripts/config/config_clean.sh" "${mlz_config_file}" # clean up reources that was created by deploy.sh -rm -rf "${configuration_output_path}/${mlz_env_name}.mlzconfig" "${configuration_output_path}/${tfvars_filename}" \ No newline at end of file +rm -rf "${configuration_output_path}/${mlz_env_name}.mlzconfig" "${configuration_output_path}/${tfvars_filename}" +rm -rf "${this_script_path}/core/*/${tfvars_filename}" From 975e23e103497edca1d9d2d108e09877e54598be Mon Sep 17 00:00:00 2001 From: jjansen23 Date: Mon, 10 May 2021 07:37:43 -0400 Subject: [PATCH 3/6] used explicit tiers instead of '*' --- src/clean.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/clean.sh b/src/clean.sh index 76ebcfffb..4fc97abed 100755 --- a/src/clean.sh +++ b/src/clean.sh @@ -100,4 +100,5 @@ echo "INFO: cleaning up MLZ resources with tag 'DeploymentName=${mlz_env_name}'. . "${this_script_path}/scripts/config/config_clean.sh" "${mlz_config_file}" # clean up reources that was created by deploy.sh rm -rf "${configuration_output_path}/${mlz_env_name}.mlzconfig" "${configuration_output_path}/${tfvars_filename}" -rm -rf "${this_script_path}/core/*/${tfvars_filename}" +rm -rf "${this_script_path}/core/saca-hub/${tfvars_filename}" "${this_script_path}/core/tier-0/${tfvars_filename}" +rm -rf "${this_script_path}/core/tier-1/${tfvars_filename}" "${this_script_path}/core/tier-2/${tfvars_filename}" From 92c0f144daa97d8577c91b3507a43d1b7ed6ecff Mon Sep 17 00:00:00 2001 From: jjansen23 Date: Mon, 10 May 2021 10:43:03 -0400 Subject: [PATCH 4/6] added function to delete files in dir by name --- src/clean.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/clean.sh b/src/clean.sh index 4fc97abed..071ecf4bc 100755 --- a/src/clean.sh +++ b/src/clean.sh @@ -95,10 +95,24 @@ echo "INFO: destroying Terraform using ${mlz_config_file} and ${tfvars_path}..." "${tfvars_path}" \ "y" +#function to remove files wherever they exist +delete_files_in_directory_by_name() { + directory_to_search=$1 + file_name_to_match=$2 + + matches=$(find "$directory_to_search" -type f -name "$file_name_to_match") + + for match in $matches + do + echo "deleting $match ..." + rm -f "$match" + done +} + # clean up MLZ config resources echo "INFO: cleaning up MLZ resources with tag 'DeploymentName=${mlz_env_name}'..." . "${this_script_path}/scripts/config/config_clean.sh" "${mlz_config_file}" # clean up reources that was created by deploy.sh -rm -rf "${configuration_output_path}/${mlz_env_name}.mlzconfig" "${configuration_output_path}/${tfvars_filename}" -rm -rf "${this_script_path}/core/saca-hub/${tfvars_filename}" "${this_script_path}/core/tier-0/${tfvars_filename}" -rm -rf "${this_script_path}/core/tier-1/${tfvars_filename}" "${this_script_path}/core/tier-2/${tfvars_filename}" +rm -rf "${configuration_output_path}/${mlz_env_name}.mlzconfig" "${configuration_output_path:?}/${tfvars_filename}" + +delete_files_in_directory_by_name "$this_script_path" "$tfvars_filename" From d52bd94ffc8a1969309aafbda178f27da2777d9b Mon Sep 17 00:00:00 2001 From: jjansen23 Date: Mon, 10 May 2021 15:57:38 -0400 Subject: [PATCH 5/6] changed order file deletes --- src/clean.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/clean.sh b/src/clean.sh index 071ecf4bc..29a3489e2 100755 --- a/src/clean.sh +++ b/src/clean.sh @@ -110,9 +110,7 @@ delete_files_in_directory_by_name() { } # clean up MLZ config resources +delete_files_in_directory_by_name "$this_script_path" "$tfvars_filename" echo "INFO: cleaning up MLZ resources with tag 'DeploymentName=${mlz_env_name}'..." . "${this_script_path}/scripts/config/config_clean.sh" "${mlz_config_file}" -# clean up reources that was created by deploy.sh rm -rf "${configuration_output_path}/${mlz_env_name}.mlzconfig" "${configuration_output_path:?}/${tfvars_filename}" - -delete_files_in_directory_by_name "$this_script_path" "$tfvars_filename" From df25cde94a3c7ffc0da32d38662b522bf1a33b0b Mon Sep 17 00:00:00 2001 From: JeromeJansen Date: Tue, 11 May 2021 05:21:30 -0400 Subject: [PATCH 6/6] Update src/clean.sh Adding the word INFO for consistency. Co-authored-by: Glenn Musa <4622125+glennmusa@users.noreply.github.com> --- src/clean.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clean.sh b/src/clean.sh index 29a3489e2..cde1ae2a7 100755 --- a/src/clean.sh +++ b/src/clean.sh @@ -104,7 +104,7 @@ delete_files_in_directory_by_name() { for match in $matches do - echo "deleting $match ..." + echo "INFO: deleting $match ..." rm -f "$match" done }