/contrib/

yes"; shift ;; --destroy-after-test) destroy_after_test="yes"; shift ;; --destroy-now) destroy_now="yes"; shift ;; -h|--help) usage ; exit 0 ;; --ssh) sshvm="yes"; shift ;; --os) case "$2" in "") shift 2 ;; *) os="$2" ; shift 2 ;; esac ;; --verbose) redirect=""; shift ;; --) shift ; break ;; *) echo "Internal error!" ; exit 1;; esac done run_tests_args="$@" } function force_location() { current_dir=$(dirname $0); if [ ! -f ${current_dir}/tests/vagrant/vagrant-template-fedora/Vagrantfile ]; then echo "Aborting." echo "The tests/vagrant subdirectory seems to be missing." echo "Please correct the problem and try again." exit 1 fi } function vagrant_check() { vagrant -v >/dev/null 2>&1; if [ $? -ne 0 ]; then echo "Aborting" echo "Vagrant not found. Please install Vagrant and try again." echo "On Fedora, run "dnf install vagrant vagrant-libvirt" " exit 1 fi } function ansible_check() { ansible --version >/dev/null 2>&1 ; if [ $? -ne 0 ]; then echo "Aborting" echo "Ansible not found. Please install Ansible and try again." echo "On Fedora, run "dnf install ansible" " exit 1 fi } function set_branchname_from_git_branch() { BRANCHNAME=`git rev-parse --abbrev-ref HEAD` if [ $? -ne 0 ]; then echo "Could not get branch name from git, will exit" exit 1 fi } function destroy_vm_and_exit() { echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!CAUTION!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo "This will destroy VM and delete tests/vagrant/${BRANCHNAME} dir" echo while true; do read -p "Do you want to continue?" yn case $yn in [Yy]* ) break;; * ) echo "Did not get an yes, exiting."; exit 1 ;; esac done if [ -d "tests/vagrant/${BRANCHNAME}" ]; then pushd "tests/vagrant/${BRANCHNAME}" eval vagrant destroy $redirect popd rm -rf "tests/vagrant/${BRANCHNAME}" exit 0 else