updated gce_is_preempted.sh

pull/2/head
Hari Sekhon 5 years ago
parent 25ecf88ef4
commit 2798db84b8

@ -37,6 +37,11 @@ if [[ "${1:-}" =~ -.* ]]; then
usage
fi
if ! curl -s --connect-timeout 2 -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/" &>/dev/null; then
echo "This script must be run from within a GCE instance as that is the only place the GCP GCE Metadata API is available"
exit 2
fi
output="$(curl -s -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/preempted")"
# shellcheck disable=SC2181
if [ $? -eq 0 ]; then

Loading…
Cancel
Save