From 8a5fd2732783e823fa1901e1c6f4f3653b7b3284 Mon Sep 17 00:00:00 2001 From: DmitriyKarpovskiy1 <58940841+DmitriyKarpovskiy1@users.noreply.github.com> Date: Thu, 8 Oct 2020 15:25:21 +0300 Subject: [PATCH] Add the force flag for the mdbci destroy command (#211) --- BUILD/mdbci/README.md | 2 +- BUILD/mdbci/build.sh | 4 ++-- BUILD/mdbci/create_full_repo.sh | 4 ++-- BUILD/mdbci/upgrade_test.sh | 6 +++--- system-test/mdbci/README.md | 2 +- system-test/mdbci/create_config.sh | 2 +- system-test/mdbci/run_test.sh | 4 ++-- system-test/mdbci/run_test_snapshot.sh | 2 +- system-test/mdbci/run_test_vm.sh | 6 +++--- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/BUILD/mdbci/README.md b/BUILD/mdbci/README.md index c6b75baec..0a8a7cf96 100644 --- a/BUILD/mdbci/README.md +++ b/BUILD/mdbci/README.md @@ -34,7 +34,7 @@ Prerequirements: * $HOME/team_keys file contains public keys to be installed to VM By default VM will not stay alive after the build. Please use ```export do_not_destroy_vm=yes``` -to prevent VM from being destroyed. In this case VM have to be destroyed manually by ```mdbci destroy``` +to prevent VM from being destroyed. In this case VM have to be destroyed manually by ```mdbci destroy --force``` command. VM will be created in ```$HOME/vms directory```, binary repository will be created the in diff --git a/BUILD/mdbci/build.sh b/BUILD/mdbci/build.sh index 9f1737311..8db3224d9 100755 --- a/BUILD/mdbci/build.sh +++ b/BUILD/mdbci/build.sh @@ -54,7 +54,7 @@ fi if [ "$already_running" != "ok" ]; then # destroying existing box if [ -d "$MDBCI_VM_PATH/${name}" ]; then - ${mdbci_dir}/mdbci destroy $name + ${mdbci_dir}/mdbci destroy --force $name fi # Just in case some old lock file left rm -rf ${snapshot_lock_file} @@ -111,7 +111,7 @@ if [ "$try_already_running" == "yes" ] ; then fi if [[ "$do_not_destroy_vm" != "yes" && "$try_already_running" != "yes" ]] ; then echo "Destroying VM" - ${mdbci_dir}/mdbci destroy $name + ${mdbci_dir}/mdbci destroy --force $name fi cd $dir diff --git a/BUILD/mdbci/create_full_repo.sh b/BUILD/mdbci/create_full_repo.sh index ec7ef9c44..fc3cdc84b 100755 --- a/BUILD/mdbci/create_full_repo.sh +++ b/BUILD/mdbci/create_full_repo.sh @@ -37,7 +37,7 @@ export name=`echo $name | sed "s|/|-|g"` # destroying existing box if [ -d "$MDBCI_VM_PATH/${name}" ]; then - ${mdbci_dir}/mdbci destroy $name + ${mdbci_dir}/mdbci destroy --force $name fi eval "cat < /dev/null` export backend_box=${backend_box:-"centos_7_"$provider} -mdbci destroy ${mdbci_config_name} +mdbci destroy --force ${mdbci_config_name} . ${script_dir}/configure_log_dir.sh @@ -88,6 +88,6 @@ ${script_dir}/copy_logs.sh cd $dir if [ "${do_not_destroy_vm}" != "yes" ] ; then - mdbci destroy ${mdbci_config_name} + mdbci destroy --force ${mdbci_config_name} echo "clean up done!" fi diff --git a/system-test/mdbci/run_test_snapshot.sh b/system-test/mdbci/run_test_snapshot.sh index 860952ea0..a6794998a 100755 --- a/system-test/mdbci/run_test_snapshot.sh +++ b/system-test/mdbci/run_test_snapshot.sh @@ -46,7 +46,7 @@ echo $JOB_NAME-$BUILD_NUMBER >> ${snapshot_lock_file} mdbci snapshot revert --path-to-nodes ${mdbci_config_name} --snapshot-name ${snapshot_name} if [ $? != 0 ]; then - mdbci destroy ${mdbci_config_name} + mdbci destroy --force ${mdbci_config_name} ${MDBCI_VM_PATH}/scripts/clean_vms.sh ${mdbci_config_name} new_config=true diff --git a/system-test/mdbci/run_test_vm.sh b/system-test/mdbci/run_test_vm.sh index 227adc4ae..b3c52fec9 100755 --- a/system-test/mdbci/run_test_vm.sh +++ b/system-test/mdbci/run_test_vm.sh @@ -22,7 +22,7 @@ mkdir -p $HOME/${mdbci_config_name}_vms export provider=`mdbci show provider $box --silent 2> /dev/null` export backend_box=${backend_box:-"centos_7_"$provider} -mdbci destroy test_vm +mdbci destroy --force test_vm cp ${script_dir}/test_vm.json $HOME/${mdbci_config_name}_vms/ test_vm_box="ubuntu_bionic_"$provider @@ -103,8 +103,8 @@ cp core.* ${logs_publish_dir} ${script_dir}/copy_logs.sh if [ "${do_not_destroy_vm}" != "yes" ] ; then - mdbci destroy ${mdbci_config_name} - mdbci destroy test_vm + mdbci destroy --force ${mdbci_config_name} + mdbci destroy --force test_vm rm -rf $HOME/${mdbci_config_name}_vms echo "clean up done!" fi