2019-04-02 20:53:19 +08:00
|
|
|
#!/bin/bash
|
2024-02-17 05:59:09 +08:00
|
|
|
set -x
|
|
|
|
if [[ -n $1 ]]; then
|
|
|
|
DIRECTORY=$1
|
|
|
|
shift
|
|
|
|
else
|
|
|
|
DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
|
|
|
fi
|
|
|
|
pushd "${DIRECTORY}"
|
2019-04-02 20:53:19 +08:00
|
|
|
|
2023-02-07 21:30:52 +08:00
|
|
|
if [[ "${CEPH_ANSIBLE_VAGRANT_BOX}" =~ "centos/stream" ]]; then
|
|
|
|
EL_VERSION="${CEPH_ANSIBLE_VAGRANT_BOX: -1}"
|
|
|
|
LATEST_IMAGE="$(curl -s https://cloud.centos.org/centos/${EL_VERSION}-stream/x86_64/images/CHECKSUM | sed -nE 's/^SHA256.*\((.*-([0-9]+).*vagrant-libvirt.box)\).*$/\1/p' | sort -u | tail -n1)"
|
2023-03-17 05:27:57 +08:00
|
|
|
vagrant box remove "${CEPH_ANSIBLE_VAGRANT_BOX}" --all --force || true
|
2023-02-07 21:30:52 +08:00
|
|
|
vagrant box add --force --provider libvirt --name "${CEPH_ANSIBLE_VAGRANT_BOX}" "https://cloud.centos.org/centos/${EL_VERSION}-stream/x86_64/images/${LATEST_IMAGE}" --force
|
|
|
|
fi
|
2021-05-25 16:02:23 +08:00
|
|
|
|
2019-04-02 20:53:19 +08:00
|
|
|
retries=0
|
|
|
|
until [ $retries -ge 5 ]
|
|
|
|
do
|
|
|
|
echo "Attempting to start VMs. Attempts: $retries"
|
2019-10-17 21:37:31 +08:00
|
|
|
timeout 10m time vagrant up "$@" && break
|
2021-05-25 16:08:55 +08:00
|
|
|
retries=$((retries+1))
|
2019-04-02 20:53:19 +08:00
|
|
|
sleep 5
|
|
|
|
done
|
|
|
|
|
2024-02-17 05:59:09 +08:00
|
|
|
sleep 10
|
|
|
|
popd
|