Compare commits

...

1 Commits

Author SHA1 Message Date
d8eba3b7be testing 2024-03-05 00:00:53 -05:00

View File

@ -28,7 +28,6 @@ fi
# Clean environment
unset PRIVATE_KEY
unset HOST_IP
unset MATCH_PATTERN
unset PKILL_ANSWER
@ -78,12 +77,17 @@ else
fi
# Grab first IP or use whatever HOST_IP_FIELD is set to and check that the guest is up
if [ -z "$HOST_IP" ]; then
HOST_IP="$(sudo -u "$SUDO_USER" vagrant ssh -c "hostname -I | cut -d' ' -f${HOST_IP_FIELD:-1}" "${1:-default}" 2>/dev/null)"
if [ -z "$HOST_IP" ]; then
echo "[ERROR]: Failed to find ${1:-default}'s IP"
exit 1
fi
HOST_IP="${HOST_IP::-1}" # trim
else
echo "[INFO]: HOST_IP configured by the shell environment"
fi
if ! ping -c 1 "$HOST_IP" &>/dev/null; then
echo "[ERROR]: Cannot ping the host IP '$HOST_IP'"