use 'mdbci destroy' instead of 'vagrant destroy' (#163)

use mdbci destroy instead of vagrant destroy
This commit is contained in:
Timofey Turenko 2018-01-30 15:48:05 +02:00 committed by GitHub
parent 6068850b18
commit f9cc2d5bbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 41 deletions

View File

@ -66,9 +66,7 @@ $(<${script_dir}/templates/build.json.template)
# destroying existing box
if [ -d "$MDBCI_VM_PATH/${name}" ]; then
cd $MDBCI_VM_PATH/${name}
vagrant destroy -f
cd ${dir}
${mdbci_dir}/mdbci destroy $name
fi
# starting VM for build
@ -78,9 +76,7 @@ $(<${script_dir}/templates/build.json.template)
${mdbci_dir}/mdbci up --attempts=1 $name
if [ $? != 0 ] ; then
echo "Error starting VM"
cd $MDBCI_VM_PATH/${name}
rm ~/vagrant_lock
cd $dir
exit 1
fi
echo "copying public keys to VM"
@ -122,11 +118,7 @@ if [ "$try_already_running" == "yes" ] ; then
fi
if [[ "$do_not_destroy_vm" != "yes" && "$try_already_running" != "yes" ]] ; then
echo "Destroying VM"
vagrant destroy -f
cd ..
rm -rf $name
rm -rf ${name}.json
rm -rf ${name}_netwotk_config
${mdbci_dir}/mdbci destroy $name
fi
cd $dir

View File

@ -30,9 +30,7 @@ echo $JOB_NAME-$BUILD_NUMBER >> ~/vagrant_lock
# destroying existing box
if [ -d "install_$box" ]; then
cd $MDBCI_VM_PATH/$name
vagrant destroy -f
cd $dir
${mdbci_dir}/mdbci destroy $name
fi
${mdbci_dir}/repository-config/generate_all.sh repo.d
@ -44,11 +42,9 @@ ${mdbci_dir}/mdbci up $name --attempts=1
if [ $? != 0 ] ; then
if [ $? != 0 ] ; then
echo "Error starting VM"
cd ${MDBCI_VM_PATH}/$name
if [ "x$do_not_destroy_vm" != "xyes" ] ; then
vagrant destroy -f
${mdbci_dir}/mdbci destroy $name
fi
cd $dir
rm ~/vagrant_lock
exit 1
fi
@ -126,9 +122,7 @@ scp $scpopt $sshuser@$IP:/var/log/maxscale/* $logs_publish_dir
chmod a+r $logs_publish_dir/*
if [ "x$do_not_destroy_vm" != "xyes" ] ; then
cd $MDBCI_VM_PATH/$name
vagrant destroy -f
cd $dir
${mdbci_dir}/mdbci destroy $name
fi
kill $pid_to_kill
exit $res

View File

@ -20,10 +20,8 @@ if [ "$product" == "mysql" ] ; then
export cnf_path=${script_dir}/cnf/mysql56
fi
${mdbci_dir}/mdbci destroy $name
mkdir -p ${MDBCI_VM_PATH}/$name
cd ${MDBCI_VM_PATH}/$name
vagrant destroy -f
cd $dir
mkdir ${MDBCI_VM_PATH}/$name/cnf
cp -r ${cnf_path}/* ${MDBCI_VM_PATH}/$name/cnf/

View File

@ -1,10 +0,0 @@
#!/bin/bash
dir=`pwd`
cd ${MDBCI_VM_PATH}/${name}
vagrant destroy -f
cd $dir
rm -rf ${MDBCI_VM_PATH}/${name}
rm -rf ${MDBCI_VM_PATH}/${name}.json
rm -rf ${MDBCI_VM_PATH}/${name}_network_config

View File

@ -63,7 +63,6 @@ res=$?
ulimit -c unlimited
if [ $res == 0 ] ; then
# . ${script_dir}/configure_backend.sh
. ${script_dir}/set_env.sh $name
cd ${script_dir}/..
cmake . -DBUILDNAME=$name -DCMAKE_BUILD_TYPE=Debug
@ -76,7 +75,7 @@ if [ $res == 0 ] ; then
if [ $? != 0 ]; then
echo "Backend broken!"
if [ "${do_not_destroy_vm}" != "yes" ] ; then
${script_dir}/destroy.sh
${mdbci_dir}/mdbci destroy $name
fi
rm ~/vagrant_lock
exit 1
@ -90,13 +89,13 @@ if [ $res == 0 ] ; then
else
echo "Failed to create VMs, exiting"
if [ "${do_not_destroy_vm}" != "yes" ] ; then
${script_dir}/destroy.sh
${mdbci_dir}/mdbci destroy $name
fi
rm ~/vagrant_lock
exit 1
fi
if [ "${do_not_destroy_vm}" != "yes" ] ; then
${script_dir}/destroy.sh
${mdbci_dir}/mdbci destroy $name
echo "clean up done!"
fi

View File

@ -48,15 +48,14 @@ export repo_dir=$dir/repo.d/
${mdbci_dir}/mdbci snapshot revert --path-to-nodes $name --snapshot-name $snapshot_name
if [ $? != 0 ]; then
${script_dir}/destroy.sh
${mdbci_dir}/mdbci destroy $name
${MDBCI_VM_PATH}/scripts/clean_vms.sh $name
${script_dir}/create_config.sh
checkExitStatus $? "Error creating configuration" $snapshot_lock_file
. ${script_dir}/configure_backend.sh
checkExitStatus $? "Error creating configuration" $snapshot_lock_file
echo "Creating snapshot from new config"
$HOME/mdbci/mdbci snapshot take --path-to-nodes $name --snapshot-name $snapshot_name
${mdbci_dir}/mdbci snapshot take --path-to-nodes $name --snapshot-name $snapshot_name
fi
. ${script_dir}/set_env.sh "$name"