diff --git a/bin/setup-openstack.sh b/bin/setup-openstack.sh index 768df84c..86529619 100755 --- a/bin/setup-openstack.sh +++ b/bin/setup-openstack.sh @@ -17,7 +17,7 @@ function waitErator() { local start_time start_time=$(date +%s) local timeout_seconds=$((30 * 60)) # 30 minutes - + while [ ${#pids[@]} -gt 0 ]; do # Check for timeout local current_time @@ -33,7 +33,7 @@ function waitErator() { echo "==== PROCESS TIMEOUT =====================================" exit 1 fi - + for pid in "${!pids[@]}"; do # Check if process is still running if ! kill -0 ${pid} 2>/dev/null; then @@ -41,7 +41,7 @@ function waitErator() { # Use || to prevent set -e from killing the script before we can log the failure wait ${pid} || local exit_code=$? exit_code=${exit_code:-0} - + if [ $exit_code -ne 0 ]; then echo "==== PROCESS FAILED =====================================" echo "Command: ${pid_commands[$pid]}" @@ -57,7 +57,7 @@ function waitErator() { done sleep 1 done - + echo "All processes completed successfully." } diff --git a/scripts/hyperconverged-lab.sh b/scripts/hyperconverged-lab.sh index 52638382..fba51367 100755 --- a/scripts/hyperconverged-lab.sh +++ b/scripts/hyperconverged-lab.sh @@ -10,16 +10,26 @@ EXCLUDE_LIST=() export TEST_LEVEL="${TEST_LEVEL:-off}" +# yq installation constants +YQ_VERSION="v4.2.0" +YQ_BINARY="yq_linux_amd64" + function installYq() { - export VERSION=v4.2.0 - export BINARY=yq_linux_amd64 - wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY}.tar.gz -q -O - | tar xz && sudo mv ${BINARY} /usr/local/bin/yq + if wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${YQ_BINARY}.tar.gz -O - | tar xz && sudo mv ${YQ_BINARY} /usr/local/bin/yq; then + echo "Successfully installed yq version ${YQ_VERSION}" + return 0 + else + echo "Failed to install yq" + return 1 + fi } # Install yq locally if needed... if ! yq --version 2> /dev/null; then echo "yq is not installed. Attempting to install yq" - installYq + if ! installYq; then + echo "[WARNING] Failed to install yq locally" + fi fi @@ -430,6 +440,19 @@ if [ ! -d "/etc/genestack" ]; then sudo chown \${USER}:\${USER} -R /etc/genestack fi +# Install yq on the remote host if not already present +if ! command -v yq &> /dev/null; then + echo "Installing yq on remote host..." + if wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${YQ_BINARY}.tar.gz -O - | tar xz && sudo mv ${YQ_BINARY} /usr/local/bin/yq; then + echo "Successfully installed yq version ${YQ_VERSION} on remote host" + else + echo "Failed to install yq on remote host" + exit 1 + fi +else + echo "yq already available on remote host: \$(yq --version)" +fi + # We need to clobber the sample or else we get a bogus LB vip cat > /etc/genestack/manifests/metallb/metallb-openstack-service-lb.yml <